I want to open location service screen programmatically to turn on service.
After adding prefs as a url type, use the following code to go directly to the location settings of an application.
if let url = URL(string: "App-prefs:root=LOCATION_SERVICES") { UIApplication.shared.open(url, options: [:], completionHandler: nil) }