Swift
Escaping closures
This code doesn't compile. What is the compiler asking for?
final class Loader {
var handlers: [() -> Void] = []
func register(_ handler: () -> Void) {
handlers.append(handler)
}
}How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.