How Swift Developers Should Be Using Protocol Oriented Programming

Adebayo Ijidakinro
Swift Development
Published in
5 min readDec 2, 2020

--

Photo by Joshua Aragon on Unsplash

I remember in 2015 when Protocol Oriented Programming (POP) became a big thing. David Brahams gave a speech at WWDC about it, and it exploded. All of a sudden, I was seeing articles popping up all over the place crying that as Swift developers we must implement POP in our projects.

Okay, that’s fine. I have nothing against POP. I actually things it's great. But the biggest takeaway for most people from that 2015 talk was this. “Always start with a protocol.”

It’s this phrase that I have problems with. This phrase is a rule. And rules are very dangerous in programming.

Why You Shouldn’t Always Start With A Protocol

Protocols serve a great purpose in swift development. They make your code much more modular. The ability to implement multiple protocols allows you to write code that is more like building blocks. You can put multiple blocks together to create an object. It’s very useful.

But do these advantages mean you should “always start with a protocol”? No.

Some functionality makes sense to use with a protocol. But not all functionality.

How do you know what should be put within a protocol and what shouldn’t?

--

--

Adebayo Ijidakinro
Swift Development

I’m a 10+ year iOS Developer whose worked with 6 startups. This past year I released 6 iOS and web apps. Follow me and learn how to make your Startup a success.