Generics
Constraints
FunctionsAdvanced Array Operations
Dictionary ImplementationTuplesProtocols With Associated Types
Learn by Example
class LinkedList<Element> {
var value: Element
var next: LinkedList? // The Element type here is preserved,
// so all nodes in this section have the same element type
// aka it is implied that next: LinkedList<Element>?
init(_ value: Element, _ next: LinkedList? = nil) {
self.value = value
self.next = next
}
}Other Resources
Dictionary ImplementationTuplesProtocols With Associated TypesLast updated
Was this helpful?