To break this down:
A member is either a property or a method.
An instance member is a member of an instance of a class or a struct; sometimes folks say member when you they mean instance member, but it’s best to only do that when the context is clear.
A class member is a member of a class rather than an instance.
A static member is a member of a class or a struct; static members can’t that be overriden.
So, for example:
class MyClass {
class var myClassProperty: Int { return 42 }
class func myClassMethod() {
}
static var myStaticProperty: Int { return 42 }
static func myStaticMethod() {
}
let myInstanceProperty: Int = 42
func myInstanceMethod() {
}
}
struct MyStruct {
// Class members are only allowed within classes.
//
// class var myClassProperty: Int { return 42 }
// class func myClassMethod() {
// }
static var myStaticProperty: Int { return 42 }
static func myStaticMethod() {
}
let myInstanceProperty: Int = 42
func myInstanceMethod() {
}
}
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"