Member-only story

The Sea of Swift Extensions !

The Blue Prototype
2 min readJun 11, 2022

--

Photo by Clint Patterson on Unsplash

Before diving into the Sea, lets get some brief introduction about Swift Extensions.

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 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.

Get Started

Really, Extensions are strongly needed in terms of code reusability. In our daily development life, we require lots of swift extensions. Some we know but some we don’t. So we use google to find the code and create the extensions as per our requirements. But let’s think that how it’ll easy if you find a place where you can get all the required extensions like a pool.

--

--

Responses (3)