Hurry - Only 3 left in stock!
Foreword xiPreface xiiiAcknowledgments xvAbout the Authors xviChapter 1: Introducing Swift 11.1 Basic Syntax 21.1.1 Variables and Constants 21.1.2 String Interpolation 51.1.3 Control Flow 61.2 Basic Data Types 101.2.1 Int 101.2.2 Double and Float 121.2.3 Bool 131.2.4 Strings 141.2.5 Arrays 151.2.6 Dictionaries 19Exercises 20Chapter 2: Diving Deeper into Swift's Syntax 212.1 Optionals 222.2 Generics 252.3 Type Annotations and Type Inference 282.4 Functions and Closures 292.4.1 Global Functions 302.4.2 Nested Functions 302.4.3 Closure Expressions 312.5 Tuples 322.6 switch Statements and Pattern Matching 34Exercises 37Chapter 3: Objects and Classes 393.1 Enumerations 413.2 Classes 453.3 Structures 493.4 Subclassing 513.5 Overloading 523.6 Overriding 543.7 Initialization 553.8 Properties 573.8.1 Computed Properties 593.8.2 Property Observers 603.8.3 lazy Properties 623.9 Subscripting 633.10 Protocols 653.11 Extensions 673.12 Access Control 68Exercises 73Chapter 4: Optionals 754.1 Optionals and nil 764.2 Validity Checking, Optional Binding, and Forced Unwrapping 784.3 Optional Chaining 814.4 Implicitly Unwrapped Optionals 86Exercises 88Chapter 5: Generics 915.1 Why Generics? 925.2 Generic Functions 925.2.1 Type Parameters 935.2.2 Using More Than One Type Parameter 945.3 Generic Types 945.3.1 Associated Types 985.3.2 The where Clause 100Exercises 101Chapter 6: Functions and Closures 1036.1 Functions 1046.1.1 Parameters 1046.1.2 External Parameter Names 1056.1.3 Default Parameter Values 1076.1.4 Variadic and inout Parameters 1086.1.5 Return Types 1106.2 Closures 1126.2.1 Inferring Parameters and the Return Value 1136.2.2 Trailing Closures 1136.3 Functional Programming Patterns 114Exercises 117Chapter 7: Working with Objective-C 1197.1 Interacting with C and Objective-C APIs 1207.1.1 Optional Properties and Return Values 1227.1.2 AnyObject Types 1237.1.3 Subclassing, Extensions, and Protocols 1247.1.4 Automatically Converted Types 1267.1.5 Selectors and Enums 1287.1.6 Working with C Code 1297.2 Working with Swift and Objective-C in a Single Project 130Exercises 133Chapter 8: Common Patterns 1358.1 Nested Types 1368.2 Singletons 1378.3 Using Grand Central Dispatch 1398.3.1 dispatch_once 1398.3.2 dispatch_async 1398.3.3 dispatch_after 1408.3.4 dispatch_apply 1408.4 Sequences and Generators 1418.5 Operators 1458.5.1 Operator Overloading 1468.5.2 Custom Operators 147Exercises 148Index 149
Matt Henderson has been developing for Apple's platforms since 2009 and is currently a Cocoa engineer at MartianCraft. He's given several presentations at various user groups and conferences, including 360iDev, Cocoaheads Denver, and Boulder iOS Meetup. He realized he might have a future in software when he discovered it was easier for him to program his graphing calculator to solve equations than it was to study for his math tests. He thinks that the best debugging technique is taking a walk outside in the sun or snow.Dave Wood has been developing for iOS since 2008 and OS X since 2009. He began writing code at age 9 on a TI/99/4A and instantly fell in love. He has worked on various types of projects, including systems that interface with stock exchanges, news outlets, and banking systems, as well as newspaper websites and, of course, mobile apps ranging from games, social networks, financial apps, and productivity and developer apps. When possible, he enjoys whitewater kayaking and scuba diving. Currently he runs his own development studio, Cerebral Gardens, and freelances as a Cocoa engineer for MartianCraft.