1
Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(test), userInfo: nil, repeats: true)

In Swift 3, this is the code

func test() { }

but in Swift 4 and Xcode 9 you have to write it like this:

@objc func test() { }

Why is that?

Hamish
  • 78,605
  • 19
  • 187
  • 280
Don
  • 13
  • 5

0 Answers0