Swift Protocol Requirement Quirks
A handful of protocol witness mismatches are currently allowed:
- Non-failable initializers can satisfy failable initializer protocol requirements (as I encountered above)
- Non-throwing functions can satisfy throwing function protocol requirements
- Non-escaping closure parameters can satisfy
@escaping
protocol requirements- Generic functions can satisfy non-generic protocol requirements
- Non-mutating functions can satisfy
mutating
protocol requirements- Enum cases can satisfy
static
function protocol requirements- Synchronous methods can satisfy
async
protocol requirements