Skip to content

Category: Generics

Singly linked list with generics in Swift

In this post we will go over basic usage of generics in Swift by building a simple singly linked list. Introduction to generics Generic code is code where the functionality is described without using specific types. Meaning, the code can use any types what match with constraints (if there are any). It’s best to take a look on an example. See how separate functions can be replaced with a single implementation. Generic implementation defines a placeholder for a type (in angle brackets), in those examples T was used (can be… Read more Singly linked list with generics in Swift