- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 73字
- 2021-07-02 23:54:28
Methods
Methods are functions that are associated with a particular type. Instance methods are functions that are called on an instance of a particular type. Type methods are functions that are called on the type itself.
The following example presents a class containing a type method that is named someTypeMethod():
class AClass {
class func someTypeMethod() {
// type method body
}
}
// We can call this method as follows:
AClass.someTypeMethod()