If I run this code:
fanoutObj = fanoutPost(followersList.uid, followers: followersSnap, post: post)
The answer depends on the placement of the
forloop is in the body of the function directly, the answer is "yes", because all statements on the path to the end of the function or to the return statement must complete before the function returns.
forloop is in a closure which does not get called in the function itself, gets called asynchronously, or is executed on a separate queue, the answer is "no", because only the registration of the callback must complete, while the callback itself runs separately.
One simple way to find out is to use breakpoints or debug output to check the relative order of execution.