Overcoming Default Arguments in a Protocol

Overcome the main Swift limitation for protocol

Photo by Sebastian Herrmann on Unsplash

Prerequisites:

Terminology

The issue

func fetch(url: URL, method: HTTPMethod, headers: [String : String], token: String? = nil, data: [String: Any]?, completionBlock: @escaping (Result<Data, Error>) -> Void)

Conclusion

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store