Hi Carl,
This is an interesting question!
I believe this is how you would do it. First, you need to make a variable for the time interval, like this:
var timeInterval:Int
Then you would want to set the repeats argument to false and create a new selector function. Inside the new selector you would make some logic for deciding your next interval, this could be based on a randomizer or any logic you decide. Here inside the body of the function you would assign a value from your logic to timeInterval.
Then below it you would schedule the timer again using:
Timer.scheduledTimer(timeInterval:timeInterval, target: self, selector: (#selector(ViewController.newUpdateTimer)), userInfo: nil, repeats: false)
Notice, the repeats: is also set to false here and the selector would be the new method itself(where this code is located, actually).
So, it would call itself from within the body at the interval generated by your logic.
My answer is based on this question and response from SO: https://stackoverflow.com/questions/29088575/nstimer-scheduledtimerwithtimeinterval-with-variable-delay
I hope this helps! Let me know how it turns out or if you find another solution.
Thanks for reading and commenting!