In « The Swift Programming Language (Swift 3). », they start Protocol chapter with this example :
protocol SomeProtocol {
var mustBeSettable: Int { get set }
var doesNotNeedToBeSettable: Int { get }
}
Then, they make a statement contradicting this example :
« Always prefix type property requirements with the static keyword when you define them in a protocol. This rule pertains even though type property requirements can be prefixed with the class or static keyword when implemented by a class: »
With the following example
protocol AnotherProtocol {
static var someTypeProperty: Int { get set }
}
But 2 lines later, they give another example without static :
Here’s an example of a protocol with a single instance property requirement:
protocol FullyNamed {
var fullName: String { get }
}
So, is static compulsory ? Is it compulsory only when property is settable ? What is the consequence not including static keyword ?
Or do they simply mean to use static and not class keyword.