blog

autolayout graphic

Learning Auto Layout for iOS, tvOS, and OS X

by | May 23, 2016 | Developer Blog | 0 comments

iPadPro10-ApplePencil-SmartKeyboard-Splitview_PR-PRINTWith the release of the iPhone SE and the iPad Pro, along with the expectation that iPad apps will include support for slide over and split screen mode it’s now clear that Auto Layout is here to stay. If you’re not already developing apps using Auto Layout and Size Classes now is a great time to learn more about them and prepare yourself for any updates to the APIs that Apple introduces at WWDC in June.
Fortunately there’s a lot of great resources to quickly get up to speed and learn the best way to support a variety of devices and size classes in your next app.

Apple’s Documentation
Apple has an excellent Auto Layout guide and a pair of videos from WWDC that explain how Auto Layout works and how to debug the set of constraints in the views of your app. Start with these, experiment with the frameworks and sample code, and then dig into the resources below.

Achieving Zen with Auto Layout
Achieving Zen with Auto LayoutWhile Apple’s documentation is a great place to start, the most comprehensive resource I’ve found is Achieving Zen with Auto Layout by Justin Williams. The 2nd edition has been updated to include the latest information and covers everything from the history of the frameworks to animating and debugging constraints in your app. The $40 ebook and collection of sample code is essential.
 
Reveal – runtime view debugging
Reveal-noshadow
Xcode includes some visual debugging tools but they pale in comparison to Reveal by Australia’s Itty Bitty Apps. The Reveal framework is dead simple to integrate into your Xcode project and the UI is incredibly slick and easy to use. The ability to inspect and edit constraints live while your app is running is invaluable and alone is worth the price of a license. However, the app includes many other features unrelated to Auto Layout which make it an absolute must have tool for iOS and tvOS development and debugging. Version 1.6 is available now and I’ve heard that version 2.0 will include some awesome new features and changes.
Blog Posts
Finally, the development community has written a number of great posts about Auto Layout and Size Classes. Here’s a few that I’ve bookmarked which I find myself turning back to again and again.

(top image from apple.com)

+ more

Accurate Timing

Accurate Timing

In many tasks we need to do something at given intervals of time. The most obvious ways may not give you the best results. Time? Meh. The most basic tasks that don't have what you might call CPU-scale time requirements can be handled with the usual language and...

read more