Liulishuo Tech Team
Liulishuo Tech Team
Apr 25, 2018 · Fundamentals

Mastering Swift 4.1: Recursive Associated Types and Type Erasers Explained

Swift 4.1 finally supports recursive constraints on associated types, allowing protocols like Sequence to define SubSequence in terms of itself; this article explains the new syntax, demonstrates a minimal DummySequence implementation, and shows how type‑erasing wrappers such as AnySequence and a custom AnyList enable heterogeneous collections.

Associated TypesGenericsSequence
0 likes · 8 min read
Mastering Swift 4.1: Recursive Associated Types and Type Erasers Explained