Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #import "Thing.h" |
2 | |||||
3 | @interface Thing () | ||||
4 | |||||
5 | @end | ||||
6 | |||||
7 | @implementation Thing | ||||
8 | |||||
9 | + (instancetype)thing { | ||||
10 | static Thing* thing = nil; | ||||
11 | static dispatch_once_t onceToken; | ||||
12 | dispatch_once(&onceToken, ^{ | ||||
13 | thing = [[[self class] alloc] init]; | ||||
14 | }); | ||||
15 | return thing; | ||||
16 | } | ||||
17 | |||||
18 | - (void)sayHello { | ||||
19 | NSLog(@"Hello World"); | ||||
20 | } | ||||
21 | |||||
22 | @end |