March 2017
Intermediate to advanced
226 pages
5h 13m
English
Swift does not use comma-first styling. Coders moving from JavaScript and Haskell have made slight inroads in adopting this convention in collections and declarations:
| | var dictionary = [ "a": "apple" |
| | , "b": "bat" |
| | , "c": "cat" |
| | , "d": "dog" |
| | "e": "elephant" // error on this line, missing comma |
| | , "f": "frog"] |
| | |
| | func someLongFunction(arg1: Int |
| | , arg2: Int |
| | , arg3: Int |
| | , onCompletion: () -> Void) { |
| | } |
Supporters say it’s easier to catch syntactic errors because of the leftmost line of leading commas. Detractors respond that Swift’s compiler will easily catch this class of errors, limiting the utility of an unusually ugly style choice. I’m not personally a fan. I’d ...
Read now
Unlock full access