iOS 9 Day by Day: a Review of iOS 9 for Developers
iOS 9 Day by Day is a free book by shinobicontrols’ Chris Grant that provides a review of iOS 9 for developers. The book comprises 13 short chapters that puts the key features of iOS 9 at work in the accompanying sample projects.
InfoQ has extensively covered iOS 9 in the past few months. Among the motivations for InfoQ’s “iOS 9 for Developers” series and ebook were trying to help developers catching up with new features in iOS 9 SDK and related tools, and provide a broad overview of all new or updated frameworks. iOS 9 Day by Day addresses the same kind of concerns, though it does it by providing sample projects that show hands-on how the new features can be used.
Here is a list of all 13 chapters, each one accompanied by an Xcode project:
- Search APIs
- User Interface testing
- Storyboard references
- Xcode code coverage
- Contacts framework
- Apple Pay
- UIKit Dynamics
- MapKit Transit
- GamePlayKit – pathfinding
- GamePlayKit – behaviors and goals
- CloudKit web services.
The book was born out of a collection of independent posts. This makes each chapter a self-contained tutorial that can be read on its own. All projects are implemented in Swift.
InfoQ has spoken with Sam Burnstone, shinobicontrols’ Technical Evangelist, about Swift and the iOS development ecosystem.
What are the three most important features of iOS 9, in your opinion?
Feature 1) UIStackView - AutoLayout is a bit of a beast to get your head around at first. Pinning a view to its container is pretty simple, but more complex view hierarchies, such as those that require views to be positioned in relation to each other are tricky to accomplish either programmatically or using storyboards; it quickly descends into a tangled mess of layout constraints.
Apple has obviously realised this and introduced UIStackView, which takes most of the pain away from laying out views. All that’s required of the developer is to position the stack view itself and define the axis on which sub-views should be arranged (either horizontally or vertically). The view will then handle the displaying of its sub-views automatically. The ability to nest StackViews inside one another is extremely powerful, and results in a much more manageable layout, due to the dramatic reduction in layout constraints.
Feature 2) Search - iOS 9 allows developers to expose their app’s content to iOS, making it possible for users to view the content without leaving their home screen. The deep-linking that can be achieved using NSUserActivity allows users to jump straight from the result to the location in the application, which dramatically improves the user experience.
Feature 3) Right to left support - Although there are undoubtedly more exciting features, this was quite an interesting addition in my opinion. We often forget that there are regions of the world that may not use applications in the same way we do. The good news is apps that predominantly use stock UIKit will have to do almost nothing to reap the benefit of right to left language support, aside from localising their content.
Which of the projects that made into the book were the most fun to write?
I think the StackView chapter was particularly interesting. When researching the new feature, we were amazed at how little code was required to lay out almost any view hierarchy; simply drag a few views onto a storyboard and add a couple of simple constraints! The API seems to have been very well thought out and has some additional bonus features such as the ability to animate the showing and hiding of an arranged sub-view.
Having implemented an extensive set of small and varied projects, how would you deem Swift’s maturity as a replacement of Objective-C?
Swift is certainly mature enough to develop entire projects in. Its interoperability with existing code bases written in C and Objective-C, mean you can migrate your existing code base across. However, you can also continue to develop in Objective-C and simply annotate your old code base with some of the new attributes Apple has introduced, to improve how Objective-C APIs are consumed in Swift.
The pace at which Swift is evolving is pretty exciting, although the downside of this is that code built with a previous version of the language often breaks upon the next release. Apple’s commitment to developing Swift out in the open however, means developers will now be aware of what areas of their code base may break and can respond much sooner to these changes.
The tools for developing in Swift are still pretty primitive at the moment, although I really like the direction Apple is going with Xcode Playgrounds; they seem like they could be a great tool for teaching or trying out a new algorithm. Apple really seems to be pushing Swift as a great first language to learn, and putting in a lot of work in making it as accessible as possible.
shinobicontrols is a company that markets interactive UI controls for iOS and Android developers, such as shinobicharts, shinobitoolkit, and shinobiforms.