I want to to run a timer to show a toast message on the view controller but I am getting error: @objc can only be used with members of classes, @objc protocols, and concrete extensions of classes
@objc protocol Test: class {
var name: String { get }
func showToastMessage()
}
extension Test {
var timer: Timer {
return Timer.scheduledTimer(timeInterval: 3.0, target: self, selector: #selector(showToastMessage), userInfo: nil, repeats: false)
}
@objc func showToastMessage() {
}
}