
Objective-C Singleton Pattern Updated For Testability
At Two Bit Labs we do a fair amount of unit testing. In places where we use singletons we use a variation on the the Objective-C dispatch_once pattern of thread safe singleton creation. This variation supports resetting the singleton or replacing it with a mock object. That way in our unit tests we can do […]

Kickstart your apps with the iOS Xcode Starter Project
We created the iOS Xcode Starter Project to make it quick and easy to start a new iPhone or iPad app. Our goal was to create a template to save the hours of effort it takes on a new project configuring essential open source libraries, the unit and functional testing environments, analytics, multiple targets, multiple […]
Behavior Driven Development what?
Like many, I was fuzzy on BDD or Behavior Driven Development until I started working with BDD tools like Cucumber, JBehave, and Jasmine. However, BDD isn’t a tool. It’s a design approach you can use with your existing testing tools or by adding in additional tools. BDD refers to one way of doing TDD or […]
Mocking singletons with OCMock
Although Graham Lee might not approve, I occasionally use the singleton pattern, particularly for managing access to my data models. Singletons in Cocoa are accessed using the following convention: static UserModelManager *sharedManager = nil; +(UserModelManager *)sharedManager { if (sharedManager == nil) { sharedManager = [[super allocWithZone:NULL] init]; […]