Need help for Swift 2.x - 3.0 on This Program Flow

I did not add any code since I was hoping this was better than the code I have scattered…? I have a small app that basically calls some functions when button tapped:

  1. listener() functions fires off after [buttonTapped]:
    a. sets up the UI
    b. calls the animation fuc()

  2. [buttonTapped] then calls:
    a. recorder() func to setup the AV stuff
    b. recordTimer()
    i. recordTimer(): has a timer for 10 seconds

  3. [buttonTapped] then calls:
    a. gatherInput() func:
    i. has a scheduled timer with repeat: true
    ii. a selector that calls levelTimerCallback()

  4. while timer is running(repeating) the levelTimerCallback() on a selctor:
    a. IF statement to record while sound in threshold

  5. *** Now I need to call the decisionMaker() func ONLY after timer is done with its timed repeat – how can I do that since the timer() already calling a selector to keep running every time the timer() fires of on the repeat?
    I have a function that is a timer(repeat) with a selector: calling a function to check sound threshold

ONCE timer is done with the repeat from the time frame

How then to call the decisionMaker() function as I pass the global variable of the average measurement so I can then decide if it is good or bad measurement to call my custom UIAlert

I don’t think this forum is the right place to ask about Swift programming questions; you might try Stack Overflow instead. If you want, you can PM me, and I’ll see if I can help you (I will need to see code though, as I don’t think I understand your problem).

2 Likes