Discover the do's and don'ts involved in crafting readable Swift code as you explore common Swift coding challenges and the best practices that address them. From spacing, bracing, and semicolons to proper API style, discover the whys behind each recommendation, and add to or establish your own house style guidelines. This practical, powerful, and opinionated guide offers the best practices you need to know to work successfully in this equally opinionated programming language. Apple's Swift programming language has finally reached stability, and developers are demanding to know how to program the language properly. Swift Style guides you through the ins and outs of Swift programming best practices. This is the first best practices book for serious, professional Swift programmers and for programmers who want to shine their skills to be hired in this demanding market. A style guide offers a consistent experience of well-crafted code that lets you focus on the code's underlying meaning, intent, and implementation. This book doesn't offer canonical answers on Swift coding style. It explores the areas of Swift where structure comes into play. Whether you're developing a personal style or a house style, there are always ways to enhance your code choices. You'll find here the ideas and principles to establish or enhance your own best style practices. Begin with simple syntactical styling. Strengthen code bracing for easy readability. Style your closures for safety and resilience. Perfect spacing and layout. Master literal initialization and typing. Optimize control flow layout and improve conditional style choices. Transition from Objective-C and move code into Swift the right way. Boost API design using proper naming and labeling. Elevate defaulted arguments and variadics to their right places. Finally, Erica offers her own broad recommendations on good coding practice. What You Recent version of the Swift programming language
Loved it! Swift Style is not a plain styleguide or “how to indent you code� book. It is much more than that. Even seasoned Swift programmers will learn several neat tricks, shine light on some grey “how do I name/refactor this object or protocol� areas, and organize tools that language provides.
As a bonus, book is extremely easy to read and can be read-through on a weekend with tons of time to spare.
Super recommended for any Swift programmer. I’d argue it’s mandatory reading after Apple’s own “The Swift Programming Language� and “Using Swift with Cocoa and Objective-C� for any beginner and someone who’s experienced developer, but is starting out on Apple platforms or with Swift in general.
Style matters. And you have to have a style-guide agreed upon in your project.
This book gives you a good guidance how you can achieve style in Swift projects. It has subjective inputs based on the author's experiences but I think this is better than objective formatting tips because every project / coder has different needs.
The only drawback in my eyes is that code formatting options should be configured and no tools are introduced in this book how you can ensure that everyone keeps the same formatting.
I think this is a great guide for developers looking to finalize their approach to writing in Swift. I personally found very little changed for my own style choices, as I already use almost all of the standards Sadun suggests. That said, I did find it helpful to solidify the reasons why I do things the way I do, and helped clarify some of the technical history and debates lurking behind different coding styles.
It is a book that's unlikely to change your approach to coding in any radical way, but it should help give your in-house style the final touches of polish it needs before you move on to other areas of improvement.
Swift has been a swiftly moving target. Now that it has settled down, a book like this is useful to take stock of where we are. Although a style guide, and a good one, I primarily read the book to see if I had a good handle on Swift. I don't. There are a lot of new things in the language I was unaware of. There are dozens of usage pointers in this book that are very helpful. I am going to skim back through the book and take some notes. From the style guide point of view, style always causes debate, though I thought the author's suggestions seemed very reasonable. I got a feel for what is "Swifty" and what isn't. With a new language like Swift it is important to allow it its own sense of style, uncontaminated by the likes of objective C, or Java, or C++, or others. The author has taken a major step turns establishing that style. Overall an excellent book.