What use are the Swift Timer initializers?

I am doing a tutorial on Swift porgramming, and there is an example with Timer. The course uses a class method scheduledTimer to create a working Timer instance. There are cases with either selector syntax or closures. I noticed that there are also init()s defined with the same parameters, but when I tried using an init rather than the scheduledTimer, the timer didn't do anything, at least it didn't start.


So, what are those initialisers for?

Accepted Reply

If you create a timer object, you can get it running manually later on. That's part of what the init methods are there for.

See 'scheduling timers' in https://developer.apple.com/reference/foundation/timer

Replies

If you create a timer object, you can get it running manually later on. That's part of what the init methods are there for.

See 'scheduling timers' in https://developer.apple.com/reference/foundation/timer