User Tools

Site Tools


ios-labs-s14:advanced-singleton

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ios-labs-s14:advanced-singleton [2014/02/24 13:07]
mbarboi created
ios-labs-s14:advanced-singleton [2014/02/24 13:10]
mbarboi
Line 28: Line 28:
 </​code>​ </​code>​
  
-//​dispatch_once//​ is a C method part of GCD (Grand Central Dispatch), a method of coordinating and synchronizing threads. The contents of the block will only be called once.+//​dispatch_once//​ is a C method part of GCD (Grand Central Dispatch), a method of coordinating and synchronizing threads. The contents of the block will only be called once. The instance is stored in the static variable //​recorder//​ and is returned at the end of every accessor call
  
 Example invocation of singleton accessor, returning singleton: Example invocation of singleton accessor, returning singleton:
   [TripRecorder recorder]   [TripRecorder recorder]
   ​   ​
 +Note that the //init// method of the singleton is still called when the singleton is created, you should put initialization code here.
  
ios-labs-s14/advanced-singleton.txt ยท Last modified: 2014/02/24 13:10 by mbarboi