Pergunta de entrevista da empresa Uber

Implement async task dispatcher with ability to cancel tasks, using GCD internally.

Respostas da entrevista

Sigiloso

24 de jun. de 2019

NSOperations use GCD “internally”, I wonder if setting that up would have been an acceptable answer, since it already has cancel? Probably not, they probably want the implementation.

Sigiloso

30 de out. de 2017

We can create a class DispatchCancelTask with a cancel property and static method with return type as the class. Parameters to the method can be the queue, type, and completion handler as closure with void input and return type, check for is canceled property before executing the closure.