I am trying to build a countdown timer in xcode but for some reason it does not work.
I have tried all kinds of methonds but I still keep getting the same error.
import Foundation
import UIKit
class SecondViewController: UIViewController {
// text field counter
var count:Int = 300
@IBOutlet weak var counter: UILabel!
let timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(countDown), userInfo: nil, repeats: true)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view
}
@objc func countDown(){
counter.text = String(count)
count -= 1
}
}
This is the error that I got:
-[__SwiftValue countDown]: unrecognized selector sent to instance 0x6000025dde00
