title: How to make time delay repeat infinitely in swift
body: <p>I have this code and it calls a function called tapped coin but I need this delay function to continue to repeat indefinitely so the user can simulate this automatic tap.</p>
  
  <pre><code>delay(1) {
      for i in 0...5 {
          print(i)
          self.tappedCoin()
      }
  }
  </code></pre>
  
  <p>The delay function looks like this</p>
  
  <pre><code>func delay(delay: Double, closure: ()-&gt;()) {
      dispatch_after(
          dispatch_time(
              DISPATCH_TIME_NOW,
              Int64(delay * Double(NSEC_PER_SEC))
          ),
          dispatch_get_main_queue(),
          closure
      )
  }
  </code></pre>
  
  <p>How can I get this to continue repeating every second without affecting anything else in the code?</p>