July 2017
Intermediate to advanced
284 pages
6h 45m
English
One of the big differences between Swift and Objective-C is how parameters work when a Swift function is called. If you love the verbosity of Objective-C, like I do, keep in mind that parameter names are not included externally by default when a Swift function is called:
| | func hello(name: String) { |
| | println("hello \(name)") |
| | } |
| | |
| | hello("Mr. Roboto") |
This may not seem so bad until you add a few more parameters to your function:
| | func hello(name: String, age: Int, location: String) { |
| | println("Hello \(name). I live in \(location) too. |
| | When is your \(age + 1)th birthday?") |
| | } |
| | |
| | hello("Mr. Roboto", 5, "San Francisco") |
If you only read hello("Mr. Roboto", 5, "San Francisco"), you would have a hard time knowing what ...
Read now
Unlock full access