Skip to content

Instantly share code, notes, and snippets.

@mjhb
mjhb / SmallCaps.swift
Last active December 29, 2017 18:20 — forked from liamnichols/SmallCaps.swift
An extension to simplify use of small caps within a UIFont object in Swift. Updated for Xcode-9.2
import UIKit.UIFont
public extension UIFont {
/// Helper method to create a UIFont with updated attributes applied to the UIFontDescriptor
///
/// - parameter attributes: The new attributes to apply to the fontDescriptor
///
/// - returns: A UIFont object with the new attributes appended to the receivers fontDescriptor
func addingAttributes(_ attributes: [UIFontDescriptor.AttributeName : Any] = [:]) -> UIFont {