How to accurately time "click" intervals in swift/iOS2020-02-14 ios swift timer intervals
How can I accurately time "click" intervals in Swift/iOS? My online search suggests it's not as trivial as I'd anticipated.
Using iOS 13 and Swift 5, I have an array of Doubles representing time intervals in seconds. I want to generate a series of sounds (clicks?) separated by each of these intervals in sequence.
I found a couple of relatively old threads about metronomes, etc.:
that suggest that using timers isn't that accurate. These threads are a decade old and often use a repeated interval versus reading from an array.
Where should I be looking? Timer? Date?
- How do I call Objective-C code from Swift?
- dispatch_after - GCD in Swift?
- Split a String into an array in Swift?
- Do Swift-based applications work on OS X 10.9/iOS 7 and lower?
- @selector() in Swift?
- Swift for loop: for index, element in array?
- #ifdef replacement in the Swift language
- #pragma mark in Swift?
- Swift Beta performance: sorting arrays
- Getting accurate ticks from a timer in C#