Testing Singletons in Swift – Property Injection
In a previous post we showed how to test Singletons with Constructor Injection. This will show another technique using Property Injection. Property Injection is useful in cases where a custom init method isn’t practical. A useful case for this is testing ViewControllers created by a Storyboard. So what’s the difference? Instead of injecting the dependencies…
Read moreTesting Singletons in Swift
Singletons are the scourge of good software design. But everyone uses them, especially in iOS development. This post will show one way to make singletons testable in Swift applications. Let’s be real, we’re not building web apps. Long running objects are part of the game for client development. State happens. Singletons are a simple way to…
Read moreUnit Testing for iOS References
Here are some links to resources I tend to mention in my iOS Unit Testing presentations. They are excellent resources for anyone trying to start unit testing their iOS apps. Books: Test Driven iOS Development – Graham Lee Blogs: Quality Coding iOS Unit Testing Screencasts: UIViewController TDD TDD Kata for iOS: MVP (Model-View-Presenter) Pattern Not…
Read moreDependency injection is not a virtue in Objective-C
David Heinimeier Hansson recently chastised Rubyists for an increasing reliance on Dependency Injection. Here’s the article for those who haven’t seen it. tl;dr Dependency Injection is mostly unneeded in dynamic languages. Rubyists who use DI are Java wannabes. Now, I come from a strong statically typed background. I cut my teeth on C++ and most…
Read more