[1] Singleton When a class is restricted to just one instantiation, that one object is called a singleton. A singleton class returns the same instance no matter how many times an application requests it. Example : + (instancetype)sharedManager { static DocumentManager * sharedDocumentManager = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedDocumentManager = [[DocumentManager alloc] init]; NSLog(@"Singleton memory address: %@", sharedDocumentManager); }); return sharedDocumentManager; } [2] Abstract Factory Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Creates a base class with abstract methods defining methods for the objects that should be created. Each factory class w...
Mobile App Developer | Technopreneur