mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-29 09:55:24 +00:00
23 lines
556 B
Swift
23 lines
556 B
Swift
//
|
|
// UIFont + Traits.swift
|
|
// CovidSafe
|
|
//
|
|
// Copyright © 2020 Australian Government. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UIFont {
|
|
func withTraits(traits:UIFontDescriptor.SymbolicTraits) -> UIFont {
|
|
let descriptor = fontDescriptor.withSymbolicTraits(traits)
|
|
return UIFont(descriptor: descriptor!, size: 0) //size 0 means keep the size as it is
|
|
}
|
|
|
|
func bold() -> UIFont {
|
|
return withTraits(traits: .traitBold)
|
|
}
|
|
|
|
func italic() -> UIFont {
|
|
return withTraits(traits: .traitItalic)
|
|
}
|
|
}
|