小编Noo*_*bie的帖子

声明一个Swift协议,它具有属性返回值CollectionType <Int>?

是这样的

protocol A {
    var intCollection: CollectionType<Int> { get }
}
Run Code Online (Sandbox Code Playgroud)

要么

protocol A {
    typealias T: CollectionType where T.Generator.Element == Int
    var intCollection: T
}
Run Code Online (Sandbox Code Playgroud)

可以在Swift 2.1中使用吗?


Swift 4的更新

Swift 4现在支持此功能!在这里阅读更多内容

protocols swift

9
推荐指数
1
解决办法
311
查看次数

标签 统计

protocols ×1

swift ×1