Protocol Extensions in Swift

Gurjit Singh
1 min readMay 3, 2020
Photo by Brian Kyed on Unsplash

A protocol can defines a set of methods that can be adopted by any class, but we can’t write code inside.On the other hand, extensions gives us the power to write code inside methods, but it can only used for one type.

In Protocol Extensions, we can extend protocols to provide implementations to all conforming types rather than extending a particular type.

--

--

Gurjit Singh

I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt and for more articles www.gurjit.co