let protocolString: String = "customProtocol"
我有一个类似的协议:
public protocol customProtocol{}
现在稍后,我知道协议的字符串名称,但不知道实际的协议,所以我想做类似的事情:
if let conformantObject = randomeObject as? protocolFromString(protocolString) {
//hey it conformed to the protocol
}
有没有做过这种转换?