Apparently it’s not possible to use @synthesize when overwriting an atomic property accessor. Xcode 4 will produce a warning.
Now, is there another way of using lazy initialization of atomic properties while still letting Xcode synthesize both getter and setter automatically, without overwriting any of them?
What you need to do is write both the setter and the getter. You can still
@synthesizeto get the storage. e.g.:You may need to do additional memory management without ARC and may want to create a different lock (instead of
self) or use a different synchronisation method, but it’ll give you the gist.