更新时间:2021-07-16 12:33:23
封面
版权信息
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Chapter 1. Introducing Swift
Defining our goals for this book
Setting up the development environment
Running our first swift code
Understanding playgrounds
Learning with this book
Summary
Chapter 2. Building Blocks – Variables Collections and Flow Control
Core Swift types
Swift's type system
Printing to the console
Control flow
Functions
Bringing it all together
Chapter 3. One Piece at a Time – Types Scopes and Projects
Structs
Classes
Enumerations
Projects
Extensions
Scope
Access control
Chapter 4. To Be or Not To Be – Optionals
Defining an optional
Unwrapping an optional
Optional chaining
Implicitly unwrapped optionals
Debugging optionals
The underlying implementation
Chapter 5. A Modern Paradigm – Closures and Functional Programming
Functional programming philosophy
Closures
Building blocks of functional programming in Swift
Lazy evaluation
Example
Chapter 6. Make Swift Work For You – Protocols and Generics
Protocols
Generics
Extending generics
Putting protocols and generics to use
Chapter 7. Everything Is Connected – Memory Management
Computer data storage
Value types versus reference types
Automatic reference counting
Strong reference cycles
Lost objects
Structures versus classes
Chapter 8. Paths Less Traveled – Error Handling
Throwing errors
Handling errors
Cleaning up in error situations
Chapter 9. Writing Code the Swift Way – Design Patterns and Techniques
What is a design pattern?
Behavioral patterns
Structural patterns
Creational patterns
Using associated values effectively
Extending system types to reduce code
Lazy properties
Chapter 10. Harnessing the Past – Understanding and Translating Objective-C
Swift's relationship to Objective-C
Background of Objective-C
Constants and variables
Containers
Types
Calling Objective-C code from Swift
Using functions
Chapter 11. A Whole New World – Developing an App
Conceptualizing the app
Setting up the app project
Configuring the user interface
Running the app
Allowing picture taking
Temporarily saving a photo
Populating our photo grid
Refactoring to respect model-view-controller
Permanently saving a photo
Chapter 12. What's Next? – Resources Advice and the Next Steps
Apple's documentation
Forums and blogs