Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Xcode 6.3 中的 Swift 中使用了 sorted 方法
sorted(UIFont.fontNamesForFamilyName(familyName) as! [String])
我下载了 Xcode 7 beta,上面写着“排序不可用,调用集合排序”。知道出了什么问题吗?
swift 1.2 中的许多免费功能现在移到了协议扩展中
(UIFont.fontNamesForFamilyName(familyName) as! [String]).sortInPlace()
在这样解释的 swift book 协议扩展中
可以扩展协议以提供符合类型的方法和属性实现。这允许您在协议本身上定义行为,而不是在每种类型的单独一致性或全局函数中。