Andrew Bancroft 7/23/2014

Swift Access Control – Implications for Unit Testing

Read Original

This article discusses the impact of Swift's access control levels (private, internal, public) on unit testing. It explains why unit tests break when classes are marked internal by default, as test targets are separate. The author presents two solutions: changing access control to public for testable methods or adding source files to the test target, recommending the former to avoid obscure issues. The piece emphasizes testing only publicly accessible behavior, providing practical guidance for iOS developers.

Swift Access Control – Implications for Unit Testing

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser