Extensions
Extensions Add functionality to an existing type. Extensions add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you don’t have access to the original source code (known as retroactive modeling). Extensions are similar to categories in Objective-C. (Unlike Objective-C categories, Swift extensions don’t have names.) Extensions in Swift can: Add computed instance properties and computed type properties Define instance methods and type methods Provide new initializers Define subscripts Define and use new nested types Make an existing type conform to a protocol In Swift, you can even extend a protocol to provide implementations of its requirements or add additional functionality that conforming types can take advantage of....