[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...
Long waiting is over. !! iOS 12 brings Autofill for OTP text field which is close to Android provided a decade back. Previously in iOS we used to toggle between OTP text screen and message inbox. Which was hard to remember and time consuming resulting a bad user experience. Personally, I have been asked from the client/customer couple of times to implement autocompletion for OTP field and took me a lot of time to convey that it is not possible in iOS. Why Autofill was not possible previously? We all know that Apple gives at most care for user privacy. When we see iOS architecture, each individual app is like a separate island. There is no inter-app bridge between apps (exception for Keychain and URLSchemes APIs which gives very limited scope). Thus we cannot read message content from inbox. Where to start Autofilling? First of all, the target SMS need to have the OTP Code with prefix string "Code" or "Passcode"on its message content. Beware of OTP c...