Swift 2.1 中具有属性的 NSAttributedString

NSAttributedString with Attributes in Swift 2.1

最近,我已经更新到 Xcode 7.0,下面的代码在 Swift 1.2 中运行良好,但在 Swift 2.0

中出现错误
let messageString = inString
let attributes = [UIFont(): UIFont.systemFontOfSize(15.0)]
let attrString:NSAttributedString? = NSAttributedString(string: messageString, attributes: attributes)

有谁知道为什么吗?

以这种方式定义您的属性:

    let attributes = [NSFontAttributeName: UIFont.systemFontOfSize(15.0)]