ios - Will code wait for return before continuing? -


i using below code set elements in array , return array, returned array passed method more changes before again being returned.

nsmutablearray *returnarray = [[nsmutablearray alloc]init];  //call checktp1 returnarray = [self checktp1std:addingtime :starttotp1 :tp1result :nowdate :sevenhour :totalrest :returnarray];   //call check tp2 returnarray = [self checktp2std:addingtime :starttotp2 :tp2result :nowdate :sevenhour :totalrest :returnarray :tp2rest]; 

it working expected, question wait checktp1std return before executing checktp2std?

i have split code multiple methods enable more readable adding other logic pass different variable values methods,just wanted make sure basic idea work.

in general: yes

your question curious, seem concerned checktp1std return before checktp2std called, not calls alloc , init return before call checktp1std.

are intending asynchronous work in checktp1std (e.g. using gcd or system framework methods state async). if answer still yes, call may return before work scheduled checktp1std complete - nature of asynchronous programming.

hth


Comments