I am trying to implement an operation queue and I have the following scenario:
NSOperation A
NSOperation B
NSOperation C
NSOperation D
NSOperationQueue queue
One approach is to manage this from outside the operation classes ie. setup the operation dependencies between A/B/C/D correctly while creating them.
Steps: (In the method that is creating these operations)
1) Create Operation A
2) If data provided by Operation B is not available, create Operation B, and make Operation A dependent on Operation B. ie. something like operationA.addDependency(operationB);
3). repeat step 2 for C and D. (ie. B depends on C and C depends on D, if required)
4) Add the operations to queue. The queue will execute based on the dependencies ie. D, C, B, A.