Swift 4-Label-Attribute

Ich bin bewegt von swift 3 swift 4. Ich habe UILabels, dass ich bin, was sehr spezifischen Eigenschaften der Texte auf dem Etikett. Ich bin immer ein unerwartet gefunden nil while unwrapping optionaler Wert' Fehler bei der strokeTextAttributes initialisiert wird. Ich bin völlig verloren zu sein, frank.

In swift 3 die von strokeTextAttributes war [String : Beliebig] aber swift 4 warf Fehler, bis ich es geändert, was es unten ist.

let strokeTextAttributes = [
    NSAttributedStringKey.strokeColor.rawValue : UIColor.black,
    NSAttributedStringKey.foregroundColor : UIColor.white,
    NSAttributedStringKey.strokeWidth : -2.0,
    NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 18)
    ] as! [NSAttributedStringKey : Any]


chevronRightLabel.attributedText = NSMutableAttributedString(string: "0", attributes: strokeTextAttributes)
NSAttributedStringKey.strokeColor.rawValue => NSAttributedStringKey.strokeColor statt?

InformationsquelleAutor Blue | 2017-10-09

Schreibe einen Kommentar