Advanced
Swift
Q61 / 100
What is the Swift type system's existential type erasure limitation?
Correct! Well done.
Incorrect.
The correct answer is B) Protocols with associated types or Self requirements cannot be used as existential types without boxing them in AnyX wrappers or using any keyword
B
Correct Answer
Protocols with associated types or Self requirements cannot be used as existential types without boxing them in AnyX wrappers or using any keyword
Explanation
var shapes: [any Shape] requires Swift 5.7. Pre-5.7, PATs (protocols with associated types) required type erasure wrappers like AnyCollection.
Progress
61/100