swift-book
swift-book copied to clipboard
Incorrect Term Used in Adopting a Protocol Using a Synthesized Implementation
Location
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols/#Adopting-a-Protocol-Using-a-Synthesized-Implementation
Description
There are several references to associated type in the Adopting a Protocol Using a Synthesized Implementation subsection. An enumeration doesn't have an associated type. Rather, some or all of its enumeration cases may have associated values.
Correction
Replace each instance of associated type with associated value. In some cases, the wording should be adjusted to indicate the types of the associated values for clarity.
Specifically, the last two bullets in the first list should become:
- Enumerations that have only associated values whose types conform to the Equatable protocol
- Enumerations that have no associated values
The last two bullets in the second list should become:
- Enumerations that have only associated values whose types conform to the Hashable protocol
- Enumerations that have no associated types
Finally, the second sentence in the seventh paragraph should be reworded to:
If the enumeration has associated values, their types must all conform to the Comparable protocol.