Group Operation

GroupOperation can be used to execute multiple NSOperation instances on a private queue. This is a very powerful class and probably the second most commonly used after BlockOperation. Advanced techniques will be discussed in a later section, here we will cover the basics.

Direct usage

Initialize a GroupOperation with an array of NSOperation instances. Dependencies set on the operations will also be respected.

let group = GroupOperation(operations: opOne, opTwo, opThree)
group.addObserver(FinishedObserver { op in
    // the group has finished, meaning all operations have finsihed.

Once the group has started, but has not finished, it is possible to add more operations to the group.

group.addOperations([opFive, opSix])



Cancelling the group will cancel all operations in the queue.