I can see these definitions in the Swift library:
extension Bool : BooleanLiteralConvertible {
static func convertFromBooleanLiteral(value: Bool) -> Bool
}
protocol BooleanLiteralConvertible {
typealias BooleanLiteralType
class func convertFromBooleanLiteral(value: BooleanLiteralType) -> Self
}
What’s the difference between a member function defined as static func
and another one defined as class func
? Is it simply that static
is for static functions of structs and enums, and class
for classes and protocols? Are there any other differences that one should know about? What is the rationale for having this distinction in the syntax itself?