How to adopt iOS 11 user interface changes in your app

How to adopt iOS 11 user interface changes in your app

iOS 11 introduces a variety of major changes to the way apps look and work, and how they interact with the user. In fact, it’s easily the biggest set of design changes since iOS 7, and in some places actually reverses choices made in iOS 7.

[…]

Note: this article is an excerpt from my book Practical iOS 11.

[…]

This new navigation bar size forms a large part of the new bolder user interface approach that sits across all of iOS 11 – font weight has increased in places such as tab bar items, and icons are now heading back to being filled in just like they were before iOS 7.

To start trying out these new features, create a new iOS project using the Master-Detail App template, naming it Project8-iOSDesign. Go ahead and run the app in the iPhone simulator, and you’ll see the following:

To get started converting this project for iOS 11 we just need to add one line of code inside MasterViewController.swift’s viewDidLoad() method:

[…]

By overriding preferredScreenEdgesDeferringSystemGestures() we can now be far more precise. To try it out, add this code to tell iOS we want to defer swipes coming from the top but nowhere else:

[…]

The topLayoutGuide and bottomLayoutGuide properties of UIViewController have been deprecated; if you target iOS 11 and above you’ll get warnings.

[…]

While this system worked (often with some pain along the way!) it nearly always caused issues when you wanted to add your own content insets because they conflict with the system’s own adjustment. With iOS 11 Apple has split the two insets: you can go ahead and manipulate contentInsets as much as you want, and iOS will combine it with its own insets separately.

[…]