This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface MyCell : UITableViewCell | |
| +(CGSize)cellSizeForText:(NSString*)text; | |
| @end | |
| #import "UIView+NFCore.h" // "instantiateFromNib:" | |
| @implementation MyCell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // No dependency injection at all. | |
| // Instead of having independant modules, we have a strong dependency between the Controller, the ContactService and the View | |
| @interface Contact : NSObject | |
| @property NSString* name; | |
| // … | |
| @end | |
| @interface ContactService : NSObject | |
| - (void)fetchAllContactsWithCompletion:(void(^)(NSArray* contacts))completion; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dispatch_once_t onceToken; | |
| SomeClass* _sharedInstance; | |
| + (id)sharedInstance | |
| { | |
| dispatch_once(&onceToken, ^{ _sharedInstance = [SomeClass new]; }); | |
| return _sharedInstance; | |
| } | |
| - (void)tearDown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)setUp | |
| { | |
| [super setUp]; | |
| [MagicalRecord setupCoreDataStackWithInMemoryStore]; | |
| } | |
| - (void)tearDown | |
| { | |
| [MagicalRecord cleanUp]; // cleans up the CoreData stack to be ready for a clean state for the next tests | |
| // Note: any code after this line that would try to use CoreData will obviously fail |
NewerOlder