Swift

for the Really Impatient

About the Book

Swift for the Really Impatient is the perfect jumpstart to the Swift language for every experienced Objective-C developer. Leading iOS and OS X developers Matt Henderson and Dave Wood help you take full advantage of Swift's powerful innovations, without wasting time on basics you already know.

Through expert code examples and crystal-clear explanations, Henderson and Wood reveal how Swift features improve on Objective-C and show how to make the most of them. You'll quickly master "Swift-er" techniques for using objects, classes, optionals, generics, functions, closures, and more. Each chapter includes hands-on exercises designed to reinforce and deepen your skills.

You'll learn how to re-implement common Objective-C programming solutions in Swift, improving code clarity, power, and performance on both desktop and mobile devices. And, because you probably won't (or can't) abandon Objective-C anytime soon, you'll discover how to use both languages together, smoothly integrate Swift into existing projects and workflows, and gradually move your current code base into the future.

Coverage Includes

  • Using Swift's new patterns and concise, expressive syntax to produce safer, more reliable code
  • Leveraging the surprising power of Swift's data structures
  • Utilizing Swift's type system to help prevent errors common in other languages
  • Using optionals to correctly handle invalid, missing, or unknown values
  • Implementing generics to reduce duplication, improve power, and simplify maintenance
  • Abstracting functionality for reusable code while maintaining type safety
  • Isolating code in clean, flexible, low-overhead closures
  • Interacting with C and Objective-C APIs
  • Combining Swift with Objective-C in the same project
  • Avoiding gotchas in importing Objective-C classes to Swift
  • Nesting types to improve code clarity
  • Creating shared objects with soft singletons
  • Managing threading and concurrency with Swift's advanced Grand Central Dispatch (GCD) patterns

Table of Contents

Preface - Why Swift?

1. Introducing Swift
2. Diving Deeper Into Swift’s Syntax
3. Objects and Classes
4. Optionals
5. Generics
6. Functions and Closures
7. Working with Objective-C
8. Common Patterns

Swift for the Really Impatient