Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func showWazeNaviationWithUrl(_ strURL: String) {
- if let url = URL(string: "waze://") {
- if UIApplication.shared.canOpenURL(url) {
- if let url = URL(string: strURL) {
- UIApplication.shared.openURL(url)
- }
- } else {
- //Waze is not installed. Launch AppStore to install Waze app
- if let url = URL.init(string: "https://itunes.apple.com/app/id323229106") {
- UIApplication.shared.openURL(url)
- }
- }
- func startNavigation(address: String) {
- var allowedQueryParamAndKey = NSCharacterSet.urlQueryAllowed
- allowedQueryParamAndKey.remove(charactersIn: ";/?:@&=+$, ")
- let _address = address.addingPercentEncoding(withAllowedCharacters: allowedQueryParamAndKey)
- let strURL = String(format: "https://waze.com/ul?ll=%@&navigate=yes", _address!)
- self.delegate?.showWazeNaviationWithUrl(strURL)
- }
- "https://waze.com/ul?ll=R%20VISCONDE%20DE%20URUGUAI%20%2C%20311%20%20-%20CENTRONiter%C3%B3i%20-%20RJ&navigate=yes"
Add Comment
Please, Sign In to add comment