I have a function that returns either a class object or nil. The function\'s purpose is to check if a Chat exists. The chat ID\'s are stored in MySQL. If the ID
Your block is executed asynchronously, but you're trying to return a value from the enclosing function. It doesn't work that way. Your findChat function needs to take a completion block itself instead of returning a value, and then you can call that completion block from the point where you're trying to say return returnValue.