Enum Raw Values and Failable Initializers

Enumerations in Swift are first-class types the same as Structs and Classes. This means they can have instance methods and initializers and even associated values making them much more powerful than plain old Objective-C enumerations. If you assign raw values to a Swift enum the compiler will even generate a failable initializer for you. This post looks at a practical example of why that is useful and how you can add your own failable initializers.

Read On →

Updating Strings for Swift 3

I wrote a Swift String Cheat Sheet last year to help me remember how to use one of the more complex API’s in the Swift standard library. It has undergone some significant changes with Swift 3 making for some painful code migration. This is partly down to the new API naming guidelines but also because of a new model for the way collections, indices and ranges work.

These are my notes on what I needed to change to update the Swift playground for Swift 3.

Read On →

Split View Controller Display Modes

The split view controller is a complicated controller to master with many configuration properties and delegate methods with long complicated names. In this post I take a look at a minimal Xcode project to create my preferred setup for an adaptable master-detail layout that keeps both view controllers visible when screen size allows.

Read On →

Swift 3 Access Controls

Swift 3 has brought us some interesting access control changes. The differences between open and public or private and fileprivate take some getting used to. Luckily unless you are writing a framework the new rules are simple. Here is what you need to know.

Read On →

openURL Deprecated in iOS10

Apple introduced the openURL: method as a way to open external links with iOS 2. The related function canOpenURL: got some privacy controls in iOS 9 to stop you from querying devices for installed apps. Now with iOS 10 Apple has deprecated the plain old openURL for openURL:options:completionHandler:. Here is my quick guide to what you need to know to open an external link with iOS 10.

Read On →
Archives Categories
No time to watch WWDC videos?

Sign up to get my iOS posts direct to your inbox and I will send you a free PDF of my iOS Size Classes Cheat Sheet.

Unsubscribe at any time.