How do I pass params on timer selector [duplicate]
This question already has an answer here: Passing parameters to the method called by a NSTimer 6 answers func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let mostRecentLocation = locations.last else { return } print(mostRecentLocation.coordinate.latitude) print(mostRecentLocation.coordinate.longitude) Timer.scheduledTimer(timeInterval: 60.0, target: self, selector: #selector(StartTestVC.sendDataToServer), userInfo: nil, repeats: true) } func sendDataToServer (latitude: Double, longitude: Double) { SFUserManager.shared.uploadPULocation