我有协议定义一个函数return self
public protocol DBObject {
static func select(where condition:String?) -> Array<DBObject>?
}
然后购买符合DBObject
public struct Shop:DBObject {
}
guard let array = Shop.select(where:nil) else{
return
}
for shop in array {
let _ = shop as! Shop
}
我知道array
总是返回Array<Shop>
,但我不知道如何定义类似子类
static func select(where condition:String?) -> Array<conform.Type>?//Is there such a way?
怎么办?