Why do I should read this book?
Quite a lot of learners of Swift - whether those who are totally new to Cocoa/Cocoa Touch, or used to write in Objective-C - are struggling in the same situation: how to improve thier professional skill after getting started with Swift. Maybe it happens to your situation as well. When you finished the last page of Apple's Swift tutorial, thinking you had mastered the new language, then created an Xcode project with Swift, and stopped at the very first line of code. You have to recall when to use Optional and when not to. You are not sure of how to express these familiar APIs in the new language. You are always getting trouble with compiling the code, without any clue for fixing them.
Don't worry, that all quite normal. The Apple's tutorial is written for showing the syntax to you. If you want to make Swift a powerful weapon in your daily life, you have to learn it deeper and use it more. The target of this book is introducing some innovative points for you, and improving your practice skill. These parts of knowledge are necessary for engineers who are using or wishing to use Swift as their next programming language.
What is contained in this book?
It is a collection of knowledge point and tips for Swift. I myself attended WWDC 14, and saw the birth of Swift with my own eyes. From the very first minute, I am learning Swift. By now, I concluded about 100 tips for this language, and divided them into 100 chapters, from the very basic ones to some high level ones. Every chapter has unique content which should be understood by a senior developer.
This book is particularly suitable to be used as a reference and supplement of Swift official documentation. It would also become a fancy hand-book for developers. For the detail of what are contained in the book, you can refer to the Contents page of the book.
What is not contained in this book?
This should not be your FIRST book for learning Swift, and this book is no longer a tutorial for you to develop a simple calculator or note app. The main purpose of this book is clear - to explore those ignored details of Swift. Although we will not discuss the whole language in a systematic way, these points are utilized widely in developing. Based on the purpose, the chapters of the book are organized in a loose structure.
Generally speaking, if you are just looking for a beginner book of Swift, you may probably choose this one. You can first read Apple's documentation on Swift, then have a look at this book later on.
How to read this book
100 is not a small number for tips. Fortunately, every part of this book is not so tightly with each other, that allows you to just open the book and pick any chapter you like. Although I recommend to follow the order - because I paid specially attention not to refer the hard part in the earlier chapters, it is not a must-done rule. And there are links to the referred chapters as well, you can jump through the book easily, and review the related chapters as you wish. If you are not interested in some chapters, just skip them first. You can always pick these ones would help you mostly go back to the skipped chapters later.
I suggest practising the code in Xcode while reading. It could be a help to understand the intension of these sample code. Every sample code is not long, but prepared carefully. I hope you can "talk" to me by writing these codes.
There are code samples in most chapters, mainly in Swift, and some in Objective-C as a reference. All code should be able to run in Swift 1.1 (which means Xcode 6.1). Of course, the change is happening in Swift very rapidly now. Some code might be needed some modification to be compiled and run correctly. If you find it, please open an issue in the repository of this book, I will fix them as soon as possible.
If not specially pointed out, these codes could be executed in both Playground and real project, and should share the same result. But there is also the situation of the code could be only tested in Playground OR the real project. This is always caused by the limitation of the platform, and I will mention it in the chapter.
Errata and Feedback
Swift is of great speed development and this book is under Swift 1.1 currently. As some new features introduced into Swift, there might be outdated content in the book. Despite the fact that I will improve this book, it might take some time after the upgrading of the language itself.
If you find any problem in reading this book, it would greatly help if you can report it in the issue page. I will confirm these feedback and fix the issues if necessary. Every update is writing in the release note. You can also find the same list indicating what changed in the wiki page of the repository.
Aboud the author
Wei Wang (onevcat) is an iOS developer from China. He got his master degree in Tsinghua University, which is one of the best universities in China. When he was an undergrad he started to develop iOS app. Now he is a senior engineer with Cocoa and Objective-C experience. He is writing a Chinese blog about iOS development in OneV's Den with thousands of subscribers. He loves to contribute to open source community and is the author of a famous Xcode plugin VVDocumenter as well.