This one’s really quick and simple!

First create a timer (at class level probably, so it doesn’t go out of scope):

Then inside whatever function you need:

Follow it by creating the ‘Tick’ selector specified in the above (it’s just a plain ol’ function):

Now whatever you need to run periodically will do so (every 1.0 seconds as in this example).

See, told ya it was simple!

How to Schedule a Repeating Task using Swift
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This

Get your FREEapp monetisation flowchart!

Use our epic flowchart to help you find the money in your idea! If you're thinking of making an app then this is vital information!

You have subscribed! Please check your email to confirm this subscription and to receive your item!