Managing a wish list from an API
We should definitely go ahead and use @objc and make the methods optional that make sense to be optional.

In Swift, it's actually not nearly as bad to check whether or not a delegate is set up or responds to a selector.  In Objective-C, it was a big if statement.  In Swift, we can use optional chaining.

Suppose that didUpdate is an optional method.  Calling it on our delegate then looks like this:

self.delegate?.didUpdate?()


The only difference here is the ? before the parenthesis.

What this line of code says is basically:

if delegate is not nil and if delegate responds to selector "didUpdate"
    call "didUpdate" on delegate
else
    do nothing


The other important thing here is that we need to be sure that we're making our reference to the delegate a weak reference, which can only be done if our protocol is specified as @objc.  In almost every case, the object acting as our delegate is already holding a strong reference to the class that needs the delegate.  If this class also holds a strong reference back to the delegate (which you're currently doing), we've creating a retain cycle.  The memory can never be released without annoying setting each other's reference to the other to be nil... and the hard part is often times figuring out when to do that.

So, let's make our protocol be an @objc protocol and use a weak reference to our delegate, and then use optional chaining to take care of the optional methods.