Swift 4 erreur de Conversion - NSAttributedStringKey: Tout

J'ai converti mon application récemment et je reçois l'erreur

"Ne peut pas convertir une valeur de type '[Chaîne : Toute]' à attendre argument de type '[NSAttributedStringKey: Tout]?'

barButtonItem.setTitleTextAttributes(attributes, for: .normal)

Code entier:

 class func getBarButtonItem(title:String) -> UIBarButtonItem {
    let barButtonItem = UIBarButtonItem.init(title: title, style: .plain, target: nil, action: nil)
    let attributes = [NSAttributedStringKey.font.rawValue:  UIFont(name: "Helvetica-Bold", size: 15.0)!, NSAttributedStringKey.foregroundColor: UIColor.white] as! [String : Any]
    barButtonItem.setTitleTextAttributes(attributes, for: .normal)

    return barButtonItem
}

OriginalL'auteur Eazy | 2017-09-20