         }
     }
     
+    // base of URL used to open the navigation app
     public var urlString: String {
         switch self {
         case .AppleMaps:
-            return "maps.apple.com://"
+            return "http://maps.apple.com"
         case .GoogleMaps:
             return "comgooglemaps://"
         case .Navigon:

    case TomTom
    case Waze
    
    public static let AllValues: [PazNavigationApp] = [.AppleMaps, .GoogleMaps, .Navigon, .TomTom, .Waze]
    
    public static var AvailableServices: [PazNavigationApp] {
        var availableServices = [PazNavigationApp]()
        for app in self.AllValues {
            if app.available {
                availableServices.append(app)
            }
        }
        return availableServices
    }
    
    public var name: String {
        switch self {
        case .AppleMaps:

        case .Waze:
            return "waze://"
        }
    }
    
    // auxiliar property to transform a string into an URL
    public var url: URL? {
        return URL(string: self.urlString)
    }
    
    // property that checks if a given app is installed
    public var available: Bool {
        guard let url = self.url else {
            return false
        }
        return UIApplication.shared.canOpenURL(url)
    }
    
    /* func to get the full URL (in string version)
     necessary to open the navigation app on the desired coordinates */
    public func directionsUrlString(coordinate: CLLocationCoordinate2D,
                                    name: String = "Destination") -> String {
        
        var urlString = self.urlString
        
        switch self {
        case .AppleMaps:
            urlString.append("?q=\(coordinate.latitude),\(coordinate.longitude)=d&t=h")
            
        case .GoogleMaps:
            urlString.append("?saddr=&daddr=\(coordinate.latitude),\(coordinate.longitude)&directionsmode=driving")
            
        case .Navigon:
            urlString.append("coordinate/\(name)/\(coordinate.longitude)/\(coordinate.latitude)")
            
        case .TomTom:
            urlString.append("geo:action=navigateto&lat=\(coordinate.latitude)&long=\(coordinate.longitude)&name=\(name)")
            
        case .Waze:
            urlString.append("?ll=\(coordinate.latitude),\(coordinate.longitude)&navigate=yes")
        }
        
        let urlwithPercentEscapes =
            urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? urlString

        return urlwithPercentEscapes
    }

    // wrapper func to turn a string into an URL object
    public func directionsUrl(coordinate: CLLocationCoordinate2D, name: String = "Destination") -> URL? {
        let urlString = self.directionsUrlString(coordinate: coordinate, name: name)
        return URL(string: urlString)
    }
    
    /* func that tries to open a navigation app on a specific set of coordinates
     and informs it's callback if it was successful */
    public func openWithDirections(coordinate: CLLocationCoordinate2D,
                                   name: String = "Destination",
                                   completion: ((Bool) -> Swift.Void)? = nil) {
        
        // Apple Maps can be opened differently than other navigation apps
        if self == .AppleMaps {
            let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, addressDictionary:nil))
            mapItem.name = self.name
            
            let success = mapItem.openInMaps(launchOptions:
                [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving])
            
            completion?(success)
        }
        
        guard let url = self.directionsUrl(coordinate: coordinate, name: name) else {
            completion?(false)
            return
        }
        
        // open the app with appropriate method for your target iOS version
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(url, options: [:], completionHandler: {
                (success) in
