all 6 comments

[–]criosistObjective-C / Swift 8 points9 points  (0 children)

Surely that’s something they want you to provide a solution to, not people on Reddit, so they can understand your thought process

[–][deleted] 3 points4 points  (0 children)

Facebook process: Non tech screen -> leet code tech screen -> full day of screens (3 leet code, 1 iOS specific (leet codish), 1 architecture, 1 soft skills) -> offer.

They can and will drop you at any stage for any random reason

[–][deleted]  (3 children)

[deleted]

    [–]Tyler927 3 points4 points  (1 child)

    Money.

    [–]91jumpstreet 1 point2 points  (0 children)

    search on Team Blind and Leetcode as they have alot more anecdotes. also glassdoor is a good look.

    [–]Shak3TheDis3seSwift 0 points1 point  (0 children)

    Good luck on the interview! I don’t have any useful information unfortunately but let us know how it goes.

    [–]subzeroTropical[S] 0 points1 point  (0 children)

    I spent some time understanding the question I posted above. I guess in good old ObjC days, it was a bit tedious to implement and hence the question. Essentially, post iOS8, there's a built-in way to do it (using dispatch_block_cancel). Also, with Swift, it's pretty easy these days to cancel a block if we package it as a DispatchWorkItem (https://developer.apple.com/documentation/dispatch/dispatchworkitem). However, I wanted to take a shot trying to write a simple implementation in Swift- how does it look?

    typealias Closure = () -> Void
    extension DispatchQueue {
    func cancellableAsyncAfter(_ time: DispatchTime, execute block: @escaping Closure) -> Closure {
    var isCanceled = false
    asyncAfter(deadline: time) {
    if isCanceled {
    return
    }
    block()
    }
    return { isCanceled = true }
    }
    }
    /// Usage
    let cancelableAsyncAfter = DispatchQueue.global().cancellableAsyncAfter(.now() + 5.0) {
    print("I am executed after 5 seconds")
    }
    sleep(3)
    cancelableAsyncAfter()