So the answer is when a function (say A) which has function(say B) as a parameter is called, the called function (A) execution begins. As soon as the function in parameter(function B) is called the flow goes to the point where function (A) was called. Execution of that code begins and after the execution of it, the left over part of the function(A) is executed.
In the above example when getDetails is called, the execution for that function begins but when completionHandler is called the flow jumps to the { part of getDetails, only after this is finished it comes back and starts executing after the completionHanldler() is called.