My book on iOS interface design, Design Teardowns: Step-by-step iOS interface design walkthroughs is now available!

Using proportional fonts

In case you've wanted to create interfaces that mimic the precision of the clock on the iOS lock screen. Here's snippet that allows you to activate font features that enable a cleaner look:

extension UIFont {  
    var proportionalFont: UIFont {
        let settings = [
            [
                UIFontFeatureTypeIdentifierKey: kNumberSpacingType,
                UIFontFeatureSelectorIdentifierKey: kProportionalNumbersSelector
            ],
            [
                UIFontFeatureTypeIdentifierKey: kCharacterAlternativesType,
                UIFontFeatureSelectorIdentifierKey: 1
            ]
        ]
        let descriptor = self.fontDescriptor().fontDescriptorByAddingAttributes([
            UIFontDescriptorFeatureSettingsAttribute: settings
            ])
        return UIFont(descriptor: descriptor, size: self.pointSize)
    }
}

The above category generates a font (where available) that has proportionally spaced digits and uses alternative glyphs for certain punctuation symbols where appropriate.