         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 {
-        if self == .AppleMaps {
-            return true
-        }
         guard let url = self.url else {
             return false
         }
         return UIApplication.shared.canOpenURL(url)
     }
     
-    public func directionsUrlString(coordinate: CLLocationCoordinate2D, name: String = "Destination") -> String {
+    /* 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
+        
+        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)
     }
     
-    public func openWithDirections(coordinate: CLLocationCoordinate2D, name: String = "Destination", completion: ((Bool) -> Swift.Void)? = nil) {
+    /* 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])
+            
+            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

import CoreLocation
import MapKit

public enum PazNavigationApp {
    case AppleMaps
    case GoogleMaps

    case TomTom
    case Waze
    
    // shortcut to access every value of possible navigation app
    public static let AllValues: [PazNavigationApp] = [.AppleMaps, .GoogleMaps, .Navigon, .TomTom, .Waze]
    
    // property that returns only navigation apps that the user has installed
    public static var AvailableServices: [PazNavigationApp] {
        return self.AllValues.filter { app in app.available }
    }
    
    // name of each app as it will appear on the Alert's options
    public var name: String {
        switch self {
        case .AppleMaps:
