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 →

Adding Swift Convenience Initializers

Do you ever find yourself wishing that Apple included an extra initializer to a UIKit class? Swift extensions make it easy to add new initializers to types without subclassing. My quick notes on adding a new convenience initializer to a UIKit class using a Swift extension.

Read On →

Auto Layout and Alignment Rectangles

It is easy to forget but Auto Layout does not use the view frame when positioning views. It uses the view alignment rectangle. Most of the time you do not need to worry about alignment rectangles as they match the view frame. It gets more interesting when you have a view that includes a drop shadow or glow effect or some other non-content addition such as a badge which can throw the default alignment off.

This post looks at how to define custom alignment rectangles to tell Auto Layout how to align such views.

Read On →

Use High Contrast For Legibility

Maybe I am getting old but I am starting to pay much more attention to how easy it is to read text on mobile devices. Text size is important but the impact of color and contrast is often overlooked. You make it harder for a user to read text when you choose text and background colours with a low contrast ratio.

But what colors make text more legible for users? If you have a coloured button are you better having white or black text for the label? In this post I share some tips I picked up from an excellent Apple WWDC session on inclusive app design.

Read On →
Archives Categories