It means the protocol declares a new member that replaces an identical member in a parent protocol, though this isn't the same thing as "shadowing" (so it isn't exactly like C#'s new
method-modifier keyword, also Swift supports static
protocols, something C#s interface
can't do).
In the link you gave for public protocol FloatingPoint
, we see that FloatingPoint
implements SignedNumeric
.
FloatingPoint
declares override mutating func negate()
- but so does SignedNumeric
- hence the need to add override
.
The official Swift language 5.1 reference states this about the override
keyword on classes (but not explicitly protocols), but the preface of the section implies that it applies to protocols insofar as it applies to all declarations:
https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID473
Methods that override a superclass method must be marked with the override
declaration modifier. It’s a compile-time error to override a method without the override
modifier or to use the override
modifier on a method that doesn’t override a superclass method.