Swift 5 Quick Learning Tutorials with Snippets
Swift 5 key feature :
1.ABI Stability: Swift is now stable language. 2.Result<Success, Failure: Error>: remove 2 callback(success and failure) for API calling. 3.Handling Future Enum Cases: @unknown default 4.Filter And Count With “count(where:)” 5.Integer Multiples With “isMultiple(of:)” 6.Remove nil from Dictionaries “compactMapValues()” .-----------------------------------------------------------------------------------------------
Swift 5 - Integer Multiples With “isMultiple(of:)”
Swift 4 Syntax let result = 5 % 2 == 0 print(result) // Output: false Swift 5 Syntax let number = 42 if number.isMultiple(of: 2) { print("\(number) is even!") }
-----------------------------------------------------------------------------------------------
Comments
Post a Comment