Search code examples
iosicloud

iCloudKit, Linking two methods to a third


I have a 3 x iCloudKit methods, fetch the banana database, fetch the apple database; and update the stock database.

But I have no way of knowing how long it will take the apple database to before it returns and/or the banana database with their answers; I effectively call them both at the same time.

Now how do I manage the update of the stock database since I don't want to update it until I have the apple & banana counts?


Solution

  • Use a boolean and call the same function when both banana and apple database return.

    This function should check the value of the boolean, perform the third request depending on its value, change its value.