【发布时间】:2020-05-13 19:16:42
【问题描述】:
我正在寻找 swift 中 static 和 class 关键字之间的区别。我需要在哪里使用静态与类。
例如;
class MyClass {
static func firstMethod() {}
class func secondMethod() {}
}
func doSomething() {
myClass.firstMethod()
myClass.secondMethod()
}
所以我们可以这样使用;
MyClass.secondMethod()
MyClass.firstMethod()
那么我应该在哪里使用静态或类?
【问题讨论】: