Preface
With the arrival of Swift 5 in early 2019, the stamp of maturity has been placed upon the Swift language. When Swift was introduced to the public in 2014, it was a sort of second-class citizen. The Cocoa frameworks that give an iOS app its functionality expect to be spoken to in Objective-C, and several megabytes of libraries had to be included in every Swift app, effectively containing the whole of the Swift language and translating everything into Objective-C. But Swift 5 introduces ABI stability, which means that, starting in iOS 10.2, the Swift language has become part of the system. Swift is now on a par with Objective-C, and Swift apps are smaller and faster.
When Swift first appeared, I immediately translated my own existing iOS apps into Swift, and found them easier to understand and maintain than their Objective-C originals. Objective-C is a powerful language with some remarkable capabilities, but it is safe to say that the vast majority of new iOS programmers will adopt Swift. It is a superb language to learn, even (perhaps especially) if you’ve never programmed before, and is the easiest and clearest way to program iOS. Swift has these salient features:
- Object-orientation
-
Swift is a modern, object-oriented language. It is purely object-oriented: “Everything is an object.”
- Clarity
-
Swift is easy to read and easy to write. Its syntax is clear, consistent, and explicit, with few hidden shortcuts and minimal syntactic trickery.
- Safety
-
Swift enforces strong ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access