Gio Lodi 3/2/2016

Using Swift protocols to abstract third party dependencies and improve testability

Read Original

This technical article discusses a common challenge in software development: testing code that depends on hard-to-control third-party components. It presents a solution using Swift protocols to abstract dependencies, using NSHTTPCookieStorage as a concrete example. The guide shows how to define a protocol, create test doubles for isolated unit testing, and extend the original class for production use, ultimately improving testability and performance.

Using Swift protocols to abstract third party dependencies and improve testability

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser