UIFont
extension UIFont
Convert SwiftUI Font to UIFont using Swift’s reflection API
-
Convert a SwiftUI font to a UIKit UIFont Three types of SwiftUI Font conversion is supported. It includes system fonts, custom fonts and Fiori fonts. In some cases, the converted UIFont may be slightly different than the original SwiftUI font.
– parameter font: The SwiftUI Font – parameter traitCollection: The traitCollection used to create UIFont
Declaration
Swift
public class func preferredFont(from font: Font, traitCollection: UITraitCollection? = nil) -> UIFont
Return Value
an UIFont