I had the opportunity to read the book “Learn to Code in Swift – The new language of iOS Apps” by Kevin J. McNeish, over year end holidays. I’ve been looking for a good book on Swift, as I spent last summer translating my own app from Objective-C to Swift. While I really didn’t know what I was doing, I had done a literal translation as a means of trying to learn the syntax of the language. Since then, I have been trying to get a better understanding of some of the differences between Objective-C and Swift, so that I may be able to clean up my app a bit.
I had met Kevin at MacWorld some years ago, and had picked up his first iBook on Obective-C. I found it to be a good beginner’s book. With that as a background I was looking forward to reading this book.
Let’s begin with the structure of an individual chapter. Each chapter has a specific theme, and within that theme Kevin spends considerable time explaining the specifics and concepts behind that that theme. Unlike many books, he doesn’t assume that you are an expert in computer theory or computer science. While he doesn’t go too deep on the theory, he does explain enough of it to help solidify the concepts of the specific theme. Each theme is broken apart into specific concepts or, if appropriate, API calls. He provides simple to understand code examples so that the concepts stick with you. He also spends enough time explaining the Xcode environment, which is a great boon for someone just getting started learning iOS programming. I have yet to find a book that does this, so it was refreshing to learn a few tricks I had not yet discovered.
Quick aside: Years ago when I first started programming professionally, I had to share a development environment with the production system on an IBM midrange computer called the System 38. The customer I was working forward got upset with me, as I used to treat it like a PC, i.e. Write some code, compile, look at the syntax errors, fix them, write some more code, rinse and repeat until the program was done. My boss came to me one day, after getting many complaints that I was impacting the customers business with all my compiles, and said – “Michael, you only get three compiles to get a program finished. One for syntax, one for debugging, and one for production use.” I was floored… How would I ever do this, well the answer was, learn how the computer thinks. Desk check your code, and program flow – making sure to fully understand all the inputs, behaviors, and outputs. This advice changed the way I programmed. I feel that I need to understand, not only the big picture, but the details and how the operating system works.
In Learn to Code in Swift, Kevin helped me get a much deeper understanding of the actual behavior and reasoning around many of the concepts I had tried to pick up by converting my code last summer.
Continuing with the structure of the chapters, Kevin then provides a handy summary of all the points he just presented. I can imagine a companion book that just consists of those summaries. Perhaps this is how he structured his outline for the book. But I find myself going back to those pages to reinforce the lessons. He then provides an exercise to allow the reader to practice what they just learned. And finally, and I love this part, he provides a video online to walk you thru the steps making sure you got the exercise right. And as with most programming books, all the source code is available for downloading.
Overall, I found this book to be an excellent starting point for people wanting to learn Swift within the context of iOS programming. Now that Apple has released Swift into Open Source, I am sure that the language will grow and mature quickly. Having a good understanding of the fundementals of the language is critical to take advantage of it overtime. Kevin’s book certainly provides you with that foundation. Highly recommended.