Function calling another function (Timing?)

Hi All,

I have tried for a long time googled and revisited the videos but I am missing something here… hopefully its a principle that I have overlooked being new to iOS development and I hope you can give me some ideas.

I have the following:

- FunctionX {
with completion returning an array

- FunctionY {

            For Loop {

        Other Code......

For Debugging, what I can see is that the Loop works and the call to Function X works, however important to note, FunctionX makes a Firebase query.

What I see is that the Other code (Outside the for loop) seems to complete execution before the firebase values come back so I think that the calls to FunctionX are not completed before the code continues… My guess is a processing sequence, threads? I looked at all sorts of options but being new to this I am not sure which is the right path to investigate… does this make sense? can you give my some guidance?

Many Thanks

Hi Damian,

Welcome to the code crew community.

Providing your actual code in each class might be more helpful in getting a reply that makes sense.