DEV Community

Davmi Jose Valdez Ogando
Davmi Jose Valdez Ogando

Posted on

2 1

100 Days of Swift - Day 11

Continuation of Hacking With Swift 100 Days of Swift

Day 11 - Protocols
(Maybe just call them interfaces?)

So protocols are in swift what interfaces are in any other language, but here protocols are a bit on steroids, and here is why. You have your usual stuff around them, access modifier, define the behavior of whoever implements them, you can abstract the concrete class by using the protocol in a parameter, etc.

What makes them powerful is the fact that they serve sort of an abstract interface when matched with Extensions, these allow you to modify data types (structs and protocols) to add a desire behavior and at the same time when paired with protocols it helps them have a default functionality, so whenever a class implements the protocol it doesn't have to build the body of all the protocol member's (so an abstract class).

Man this journey makes my brain hurts a bit.

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay