If you’ve come to Swift from a language that doesn’t use optionals, you might find the concept a little strange and the syntax unfamiliar at first. Sometimes it helps to learn the unfamiliar with something familiar – in my lightning tour…
Some time ago I answered a question in StackOverflow comparing the keyboard height on the iPhone X and the iPhone 8: I got these heights by: 1. Adding an observer of the UIResponder.keyboardWillShowNotification notification: [sourcecode language=”javascript”] NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object:…
Check out this video tutorial with a lightning tour of closures in Swift. It covers: Functions as data types Basic closure syntax Trailing closures If you’re interested in more of these sorts of videos, I’ll be posting frequently over on…
Check out this video tutorial with a lightning tour of functions in Swift. It covers: Parameter default values Optional function parameters Overloading a function If you’re interested in more of these sorts of videos, I’ll be posting frequently over on the…
In Swift 4.1, the flatMap function was divided into two functions. One kept the same name: flatMap This method flattens a sequence. Let’s say we have a two-dimensional array: [sourcecode language=”javascript”] let a = [[0,1,2],[3,4,5]] [/sourcecode] We can use the…
You must be logged in to post a comment.