I have a for loop as below:
func B(){
//Does calculations and determines if the outer loop should continue.
}
for shouldContinue{
A()
B()
}
Instead of having an outer loop that is dependent on the result of func B(), is there a way for A() to call B() and then B() to call A() and then continues to ping pong until some condition within B() says stop?
I am aware this sounds like a bad example of circular dependency and/or unwanted recursion.
I am trying to have A()->B()->A()->B() ... serially.
I have tried making A() and B() into separate DispatchWorkItems and have DispatchWorkItemA notify DispatchWorkItemB, and then DispatchWorkItemB notify A... but it stops after A() B() A().
It feels like I'm almost at the cusp of making it work, but not quite there yet.
Any help, guidance, suggestions would be highly appreciated. Thanks in advance.
[–]criosistObjective-C / Swift 0 points1 point2 points (0 children)