I got a code where the specific class is implementing the protocol, the protocol has (ex: 3 methods), but the class is implementing only one of them.
protocol MyProtocol {
func a()
func b()
func c()
}
class Foo: MyProtocol {
func a() { ... }
}
and this works, but magic is if I add a new method in the protocol eg: func d(), I got an error that class Foo doesn't implement all methods of the protocol.
What is a diff between my new method func d() and others that class Foo also doesn't implement? But on my method, I got an error, and on others no...
CodePudding user response:
This means b() and c() have default implementations. If you search for extension MyProtocol in the codebase you should be able to find their default implementations.
