Implement Optional Protocol Methods in Swift

We might not always want to implement them!

Steven Curtis
4 min readJul 23, 2021

Difficulty: Beginner | Easy | Normal| Challenging

This article has been developed using Xcode 11.5, and Swift 5.2.4

If you’d like a video version of this article, you can view this YouTube version of this article

Keywords and Terminology

Protocol: A blueprint on methods, properties and requirements to suit a piece of functionality

The problem

Protocols are great in Swift! Absolutely fantastic!

However you may want to use a protocol which has optional requirements — when you conform to a protocol only some of the functionality is required.

This would be great, as you should probably make more use of protocols than you currently are as they are a great way of providing an interface to your code.

Wait. What?

The Introduction

The Interface Segregation Principe (ISP)

If you aren’t that familiar with the SOILD principles you might want to investigate that whole article.

--

--