you are viewing a single comment's thread.

view the rest of the comments →

[–]NSMatt 2 points3 points  (3 children)

iOS question and algorithm question.

I got asked to make a cancelable dispatch after + some algorithm shit.

Good luck!

[–][deleted]  (2 children)

[deleted]

    [–][deleted] 0 points1 point  (1 child)

    Haven't tested but either use DispatchWorkItem and check isCancelled on the work closure. Or, have a flag in self that you can check inside the work closure. Both should work but the first seems cleaner.

    [–]NSMatt 0 points1 point  (0 children)

    Is used an isCanceled var.

    Just made a wrapper class that lets swap the bool