April 2017
Intermediate to advanced
316 pages
9h 33m
English
In Swift, it is possible to extend a Generic type. For instance, we can extend our Queue example struct and add new behaviors to it:
extension Queue { func peek() -> Element? { return elements.first } }
As seen in this example, we were able to use the Generic Element type in the extension.
Read now
Unlock full access