Learn to Code in Swift – a Book Review

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.

A month of the iPad Pro!

It has been a month that I’ve had the iPad pro now, and I can say I love it. It is not perfect and I will go thru a few of the problems I’ve had with it, but let me go thru what I like.

1) The screen – yes it is an amazing screen. It is big, bright, and has an incredible resolution. I’ve been amazed at how well Apple has address the scaling issue that SO many apps have. (More on this later). I am able to use the screen for very long periods without eye strain. For movies and podcasts, it’s as good, if not better, than my 27 inch iMac.
2) The Apple Keyboard – it took me about a day to get used to the keyboard. After that I find that I am typing almost as fast as my desktop keyboards. I do find that very infrequently I incorrectly position my fingers, and then all bets are off. It is light, and the covering actually makes it pretty comfortable to type on. I wish that I could adjust the title on the keyboard a bit, as I’ve been developing a major case of carpal tunnel over the last few years, but when I have to do a lot of typing it is more effective than my other iPad keyboards I have used over the years.
3) Speed – one thing that is interesting about the iPad to me, it has always been fast enough. I know that this one is faster than my iPad Air, but do I actually notice the speed? Not really, but at the same time, I’ve not noticed any slowdowns. To that end, it is running well.
4) The Apple Pencile – I got mine, a few weeks ago. I played with a tiny bit. And overall, it feels good in my hands, but I don’t really use it. I don’t have much drawing talent, and I don’t have much need to “markup” documents. So for now, this is a neutral device for me. It’s nice to have, but don’t think the average person will need it.
5) The Weight – yes it is heavier than the iPad Air. But so what. I find that I can easily take off the keyboard, and carry it like a clipboard. The weight makes it feel more substantial, and it is substantial in all respects.

The not so go:
1) Apps – I know that most developers do not have tons of time to keep updating their apps to the latest Apple technology. If you, as a developer, have kept up with Apple’s Xcode changes and recommendations, then all is good. All you have to do is add new sized graphics and everything is fine. Your app can be resized and run in side by side mode. But, most developer haven’t done this. And so, much of the really cool functionality doesn’t work for the apps. My day job is a great example of this. The apps I need for day to day work – IBM Connections, IBM Chat, and IBM Verse – none of these apps are updated to use this funcationality. I hope this is resolved quickly.
2) Keyboard – Apple enabled exchangeable keyboard in a prior release of iOS. I have been using TextExpander on my Mac and my iPad for some time. Swapping to the TextExpander keyboard (and other third party keyboards) is frustrating when using the Apple Keyboard. The external keyboard and the software keyboard tend to get confused at times… I am sure a future update will fix this.
3) Network – Apple has had problems with their wifi software both on iOS and OSX over the last few years. I am finding this same issue with the iPad Pro. Very annoying.