delegate vs callbacks

https://medium.cobeisfresh.com/why-you-shouldn-t-use-delegates-in-swift-7ef808a7f16b

The difference between delegates and callbacks is that

with delegates, the NetworkService is telling the delegate “There is something changed.”

We declare a protocol that says, whatever object conforms to this, must implement func didCompleteRequest(result: String):
This is so that we can pass the result String to that object.

Hence, we have a NetworkService object, it has a delegate to some object A that conforms to NetworkServiceDelegate. This means that object A will implement
func didCompleteRequest(result: String).

That way, whenever something is fetched from a URL, we can call on the delegate (reference that object A), and pass the result String via the protocol method
didCompleteRequest:

Hence, the delegate (the object that conforms to the protocol) is notified of the change

With callbacks, the delegate is observing the NetworkService

It will call “networkService.fetchDataFromUrl(url: “http://www.google.com”)” somewhere. Then it will observe for the data to pass through from fetchDataFromURL, and finally to the defined definition of onComplete as declared in viewDidLoad.