guard
keyword in Swift?Suggested approach: It’s most commonly used to check preconditions are satisfied, but you should also discuss how variables it creates remain in scope after the guard
block, and also how it enforces you exit the scope if the precondition fails.
For bonus points, mention that you can use guard
inside any kind of block as long as you escape afterwards – you can use it inside a loop for example.
Estimated difficulty: Easy
See the full list of iOS interview questions
Link copied to your pasteboard.