It’s really not that straightforward, so it’s good you asked to clarify.
Actually, you may see that that function in the extension is a bit different to one in the protocol. In the protocol you have:
func fetchTodoList(includingCompleted: Bool) -> [Todo]
While in the extension you have:
func fetchTodoList(includingCompleted: Bool = false) -> [Todo]
You basically create a new function, it’s new because the params are different, since one of your params now has a default value (false). And, since this new function is the same, you just call the function from the protocol and return the array the base function returns (we dropped the
return word out before the function because Swift 5 allows us to do so).
As a result, while conforming a class to this protocol, you just need to implement the function from the extension to conform to the protocol.
You can’t have a function in a protocol with default values of its params. And such a function in an extension is a small trick to add default values to protocol’s functions.
If it’s unclear for now or you feel uncomfortable with that, you can just remove this extension and work without it. But in this case, you won’t be able to drop params from the function where you call it (Xcode will help you fix all the errors in the project after you remove the extension).
Please feel free to ask me to clarify if my answer doesn’t help, I totally understand it may still seem hard to understand.