Extensions let us add functionalities to the existing classes, structs, enums, and protocols. This can be especially useful when the original type is provided by an external framework, and therefore you aren't able to add a functionality directly.
Extending functionality with extensions
Getting ready
Imagine that we often need to obtain the first word from a given string. Rather than repeatedly writing the code to split the string into words and then retrieving the first word, we can extend the functionality of String to provide its own first word.