So you understand why you can’t use a value set by asynchronous code. Well, that means you can’t return a value from asynchronous code either!Continue reading
By now you may have read this post explaining what “asynchronous” means. If you haven’t, please read it first!
So, if you understand what “asynchronous” means, then you won’t make the biggest mistake that people tend to make with asynchronous code, namely: outside asynchronous code, trying to use a value that depends on asynchronous code.
Probably the most commonly repeated iOS programming question I see on Stack Overflow is some variation on the problem of what it means for code to be asynchronous. The issue is often exacerbated when the questioner doesn’t even know that a piece of code is asynchronous.