Tag Archives: Objective-C

Brace Style in Objective-C

      No Comments on Brace Style in Objective-C

Over on inessential.com, Brent Simmons discusses brace style in Objective C. I’m glad he’s seeing the light. In 25 years of coding in C dialects, I’ve never understood why people think that omitting the brackets improves readability. Coding is not, generally, improved by brevity or obscurity. The purpose is to write code that is clear in its intent, both to the compiler, the author, and future maintainers. If you know a thing about visual design, then you know that white space is your friend, so there is no need to skimp on that either.

Unit Testing Core Data NSManagedObject with Kiwi

      5 Comments on Unit Testing Core Data NSManagedObject with Kiwi

The project that I am working on at the moment utilises Core Data for storing data, and that meant that I would need to figure out how to unit test the model. Most of what you are going to need to do is validate that your managed objects come back with appropriate defaults when first allocated, and that bounds checking… Read more »

Core Data: Transient Properties on NSManagedObject

      15 Comments on Core Data: Transient Properties on NSManagedObject

Transient properties are properties on a NSManagedObject that are not persisted to the object store. They are calculated at runtime, usually on the basis of other property values. The classic example would be for a Person object, generating a fullName property that is not persisted to the object store as both firstName and lastName are, so it can be composed at runtime.

TDD in Objective-C: Scoping an iOS Project via Mocks and Protocols with Unit Tests in Kiwi

Overview The following is an overview of how I approach Test Driven Development (TDD) for iOS projects. I use Kiwi as my TDD tool of choice, but you could apply the following with other TDD tools if you like. The only prerequisite is that the TDD tool supports mocks on protocols. App Requirements For this example I’m building an application… Read more »

TDD Exercise – A StringCalculator in Objective-C

After struggling over a custom UIControl implementation for iOS, I decided to take a little time out to play and learn more about design patterns and approaches in Objective-C. This exercise was the basis for learning a great deal about how I approach the design of a solution, and I hope it will benefit my other developments.