Swift supports static type properties, including for classes starting with Swift 1.2:
class MyClass { static let pi = 3.1415926 }
If you need to have a class variable that is overridden in a subclass, you need to use the property of the computed class:
class MyClass { class var pi: Double { return 3.1415926 } } class IndianaClass : MyClass { override class var pi: Double { return 4 / (5 / 4) } }
Nate Cook Nov 07 '14 at 15:17 2014-11-07 15:17
source share