Nicht konvertieren kann der Wert des Typs '[String : AnyObject]?' erwartet Argumenttyp '[NSAttributedStringKey : Jede]?'

Wie konvertiert man die Werte des Typs '[String : AnyObject]?'erwarteten Argumenttyp '[NSAttributedStringKey : Any]?'?

open class func drawText(context: CGContext, text: String, point: CGPoint, 
align: NSTextAlignment, attributes: [String : AnyObject]?)
{
    var point = point

    if align == .center
    {
        point.x -= text.size(withAttributes: attributes).width / 2.0
    }
    else if align == .right
    {
        point.x -= text.size(withAttributes: attributes).width
    }

    NSUIGraphicsPushContext(context)

    (text as NSString).draw(at: point, withAttributes: attributes)

    NSUIGraphicsPopContext()
}

InformationsquelleAutor Fawwad Ahmed | 2017-08-15

Schreibe einen Kommentar