试过这个,它给了我一个错误: class BaseClass { class var testProperty: String { return "Original" } class func testingFunc()-Self { return self // error - Can not convert return expression of type "Self.Type" to return the type
class BaseClass { class var testProperty: String { return "Original" } class func testingFunc()->Self { return self // error - Can not convert return expression of type "Self.Type" to return the type "Self" } }
任何想法?
谢谢
class Foo { class func classMethod() -> Foo.Type { return self // means Foo.self } func instanceMethod() -> Foo { return self // means <instance of Foo>.self } }