Posts

Showing posts from October, 2018

What is method chaining ?

In this article I will explain what is method chaining, where we can use and what are the advantages of using. Method chaining is a very less discussed and used  topic. Almofire iOS framework mostly uses the method chaining concept. The concept of method chaining is each method initialize some class properties or do something and returns self so that you can call another method on this.  Making functions chainable is quite easy and can allow us to write using an almost DSL-like syntax. Let’s consider the below method. func makeRequest(requestURL: String?, method: String?, parameters: [String: String ]?, completionHandler: @escaping ( [String:AnyObject] , bool) -> Void) In the above func if some parameter is not required we have to pass nil for that. Now Let’s consider the below APIRequest class. class APIRequest {     var url:URL?     var method = HTTPMethods.get     var params:[String:String]?     enum HTTPMethods: String { // http methods  

AutoFill OTP in iOS12 new feature (iOS12).

Image
So, finally Apple integrated autofill OTP in iOS 12…kudos to Apple. Because now a days many sites and apps required to confirm login with security code via text message.  Prior to iOS 12 it was little difficult for the user to enter the OTP as user had to toggle from OTP verification page to either messenger or Notification Centre. Then remember the entire OTP and type it back in the OTP verification page, which was really not a good user experience and consumes time. With iOS 12, you no longer have to jump from the verification page to Messages to retrieve your security code. Instead, iOS will present the security code as an auto-fill option. In iOS 12, when you receive an SMS message with an OTP or a verification code, the OS suggests the OTP in the keyboard’s quick type field . If your keyboard is present/on then at the top of the keyboard the OTP will display and just you have to press the OTP and it will fill in the textfield with the OTP automatically.. its so cool