Last week, we used generics to depend on abstractions while building concretions. This helped preserve type-information from declaration to member access, and from function arguments to return types. This week, we'll talk about a closely related feature, "associated types". Associated types are declared on protocols. Much as a protocol declares that a conforming type is required to implement certain methods, properties or conformances, an associated type requires that the conforming type specify a certain other type which will be used in those methods or properties. In that sense, they are an abstraction of the generic's parameters.

Having a protocol which declares associated types gives us more flexibility than a generic. But there are also more restrictions on how it can be used. We'll see that many of those restrictions only make sense with generics. In fact, we'll see that generics and protocol associated types were designed to work together.

Last week, we read the Swift eBook chapter on Generics up until we hit the section on Associated types. This week, let's pick up where we left off, and finish off the chapter.