它使类通用。Swift标准库没有很多泛型类的示例,但是它具有一些非常著名的泛型结构和枚举:
public struct Array<Element> : CollectionType, MutableCollectionType, _DestructorSafeContainerpublic struct Dictionary<Key : Hashable, Value> : CollectionType, DictionaryLiteralConvertiblepublic enum Optional<Wrapped> : _Reflectable, NilLiteralConvertible
在
Swift编程语言的
“泛型”下阅读有关泛型的更多信息。



