NSFontAttributeName in Swift 4

how to write

    let attr:NSDictionary = [
        NSForegroundColorAttributeName: UIColor.redColor();
        NSFontAttributeName:prgFont
    ]

in Swift 4

I think this should work:

let atts: [NSAttributedString.Key: Any] = [
    .foregroundColor: UIColor.red,
    .font: prgFont,
]
1 Like
Terms of Service

Privacy Policy

Cookie Policy