type 'UIViewController' has no member updateTimer

you need to create an updateTimer function first to be used in your selector function of the scheduledTimer function.
make sure you decorate it as objc.

Also make remove the UIViewController in the selector function since the function is only present in YOUR current viewcontroller class(InGameViewController) and not the parent UIViewController class.

    @objc func updateTimer() {
             print("timer updated")
    }

    timer = Timer.scheduledTimer(timeInterval: 1, target: self,   selector: (#selector(updateTimer)), userInfo: nil, repeats: true)

Leave a Comment