import Foundation
import Playgrounds

#Playground {
   class Clock: NSObject {
      var counter = 0
      
      func startTimer() {
         Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(runCounter), userInfo: nil, repeats: true)
      }
      @objc func runCounter() {
         counter += 1
         print("Count: \(counter)")
      }
   }
   let clock = Clock()
   clock.startTimer()
}