访问协议类型的成员在Swift中不起作用

KSC*_*KSC 5 protocols ios swift

以下是问题,如果类型是protocol.type,我无法调用类方法.是否有可以实现这一目标的替代模式.

真实情况是我有arr:[SomeProtocol.Type],我想执行let字符串:[String] = arr.map {$ 0.str}

protocol SomeProtocol: class {
   static var str: String { get }

   static func value() -> Int
}

class SomeClass: SomeProtocol {
   static var str: String = "SomeClass"

   static func value() -> Int {
      return 1
   }
}

let protocolType: SomeProtocol.Type = SomeClass.self
println(protocolType.str) // compile error
println(protocolType.value()) // compile error
Run Code Online (Sandbox Code Playgroud)

mus*_*afa 2

在此输入图像描述

如您所见,Swift 的这一部分尚未实现。(Xcode 6.3 测试版 4)