Learning NSBlockOperation

前端 未结 3 1558
滥情空心
滥情空心 2021-01-30 18:05

I\'m a big fan of blocks, but have not used them for concurrency. After some googling, I pieced together this idea to hide everything I learned in one place. The goal is to ex

3条回答
  •  抹茶落季
    2021-01-30 18:50

    There's no need to set up a block to be run on completion and add dependencies like this. NSBlockOperation like all NSOperation subclasses already has a completionBlock property which will automatically run when the block has finished its work:

    @property(copy) void (^completionBlock)(void);
    

    The completion block is run when its block moves to the finished state.

提交回复
热议问题