At the Worldwide Developer’s Conference (WWDC) in 2015, Apple announced Swift 2 which was a major update to the Swift language. Swift 2 features many exciting enhancements and changes to the Swift language and was officially release in September of 2015. Now my Mastering Swift book has been completely updated for Swift 2 and is about to be released. The new update will carry the title Mastering Swift 2.
In Mastering Swift 2 we will cover:
- Chapter 1, Taking the First Steps with Swift, will introduce you to the Swift programming language and discuss what inspired Apple to create Swift. We'll also go over the basic syntax of Swift and how to use Playgrounds to experiment and test Swift code.
- Chapter 2, Learning Variables, Constants, Strings, and Operators, will introduce you to variables and constants in Swift and when to use them. There will be brief overviews of the most common variable types with examples on how to use them. We'll conclude this chapter by showing examples of how to use the most common operators in the Swift language.
- Chapter 3, Using Collections and Cocoa Data Types, will explain Swift's array and dictionary collection types and show examples on how to use them. We'll also show how to use Cocoa and Foundation data types with Swift.
- Chapter 4, Control Flow and Functions, will show you how to use Swift's control flow statements. These include looping, conditional, and control transfer statements. The second half of the chapter is all about functions and how to define and use them.
- Chapter 5, Classes and Structures, is dedicated to Swift's classes and structures. We'll look at what makes them similar and what makes them different. We'll also look at access controls and object-oriented design. We'll close this chapter out by looking at memory management in Swift.
- Chapter 6, Using Protocols and Protocol Extensions, will cover both protocols and protocol extensions in detail since protocols are very important to the Swift language, and having a solid understanding of them will help us write flexible and reusable code.
- Chapter 7, Writing Safer Code with Availability and Error Handling, will cover the new approach to error handling, which Apple included in Swift 2, in depth as well as the new availability feature. Error handling is the process of responding to and recovering from error conditions
- Chapter 8, Working with XML and JSON Data, will discuss what XML and JSON data are and their uses. We'll then see several examples of how to parse and build XML and JSON data using Apple's frameworks.
- Chapter 9, Custom Subscripting, will discuss how we can use custom subscripts in our classes, structures, and enumerations. Subscripts in Swift can be used to access elements in a collection. We can also define custom subscripts for our classes, structures, and enumerations.
- Chapter 10, Using Optional Types, will explain what optional types really are, what are the various ways to unwrap them, and optional chaining. For a developer who is just learning Swift, optional types can be one of the more confusing items to learn.
- Chapter 11, Working with Generics, will explain how Swift implements generics. Generics allow us to write very flexible and reusable code that avoids duplication.
- Chapter 12, Working with Closures, will teach us how to define and use closures in our code. Closures in Swift are similar to blocks in Objective-C except that they have a much cleaner and easier way of using syntax. We will conclude this chapter with a section on how to avoid strong reference cycles with closures.
- Chapter 13, Using Mix and Match, will explain mix and match and demonstrate how we can include Swift code in our Objective-C projects and Objective-C code in our Swift projects. With all of the apps and frameworks written in Objective-C, it was important to allow Swift and Objective-C code to work together.
- Chapter 14, Concurrency and Parallelism in Swift, will show how to use both Grand Central Dispatch and Operation Queues to add concurrency and parallelism to our applications. Understanding and knowing how to add concurrency and parallelism to our apps can significantly enhance the user experience.
- Chapter 15, Swift Formatting and Style Guide, will define a style guide for the Swift language that can be used as a template for enterprise developers who need to create a style guide since most enterprises have style guides for the various languages that they develop in.
- Chapter 16, Network Development with Swift, will explain the Apple API's to connect to remote servers and how best to use them. Network development can be both fun and challenging.
- Chapter 17, Adopting Design Patterns in Swift, will show you how to implement some of the more common design patterns in Swift. A design pattern identifies a common software development problem and provides a strategy for dealing with it.
This book is written in an example-based approach where each topic covered is backed by examples, which are written to reinforce the topic and show how to implement it within the reader's code.
This book is for developers that want to dive into the newest version of Swift. If you want in-depth knowledge of some of the most sophisticated elements of Swift development including protocol extensions, error-handling, design patterns, and concurrency, Mastering Swift 2 gives you guidance on how to use and apply them in your own projects.
Please let me know what you think of the book because I will probably update the book with the next version of Swift and would like to know what you like and dislike about it.