Section 22: Generics

Description

Generics is a powerful functionality available in Swift to write functions and types for classes structures and enumerations. For example, if there is a function that requires the same body but works on different types, a generic function can be written to enable the use of the same code with different types. Generic types can also be written that can use different types, these can conform to protocols like any other type.

Generics resource sheet

Posted in Chapter 2: Language Guide