'Self' is the type of a protocol/class/struct/enum.And the 'self' is a instance of a class/struct/enum.As for your requirement,maybe you could write like this:
class ZKCodingModel: NSObject{
func filterSelf() -> Self {
let result = self.dynamicType.init()
return result
}
required override init() {
}
}
class ZKSubclass: ZKCodingModel {
}
let sub = ZKSubclass()
//I want to call superclass's method to return subclass' type (ZKSubclass)
let filterdSub = sub.filterSelf()
print(filterdSub)
相当于oc的instance。