阅读背景:

Swift协议扩展实现具有共享关联类型的另一协议

来源:互联网 

Consider the following:

考虑以下:

protocol Foo {
  typealias A
  func hello() -> A
}
protocol FooBar: Foo {
  func hi() -> A
}
extension FooBar {
  func hello() -> A {
    return hi()
  }
}

class FooBarClass: FooBar {
  typealias A = String
  func hi() -> String {
    return "hello world"
  }
}
protocol Foo 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: