Here is the Sample code
import Combine
import UIKit
class ViewController: UIViewController {
@IBOutlet var Discover: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func buttonClicked(_ sender: Any) {
demo().xyz()
print("Hello1")
}
public class demo {
func xyz() {
discoveryHandlerQueue.async {
var timer = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(self.timerAction), userInfo: nil, repeats: false)
print("Hello")
}
}
@objc func timerAction() {
print("timer fired!")
}
}
}
I am not able to recieve timer callback here to print "timer fired!". Why is this happening.Moment I change it from async to sync everything runs smoothly