From 636ef1c02e102bb0b33046946c3c5e724dc3ca55 Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Thu, 18 Jan 2018 12:16:43 +0100 Subject: [PATCH 1/2] Add lint yml --- .swiftlint.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .swiftlint.yml diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 000000000..5f76cb5ca --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,4 @@ +opt_in_rules: + - force_unwrapping +excluded: # paths to ignore during linting. Takes precedence over `included`. + - Carthage From cee8176f9b354b83752f68d559421dfb241299be Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Thu, 18 Jan 2018 12:17:11 +0100 Subject: [PATCH 2/2] Avoid force unwrap --- MapboxDirections/MBRouteStep.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MapboxDirections/MBRouteStep.swift b/MapboxDirections/MBRouteStep.swift index 43bebfead..85cca3ce7 100644 --- a/MapboxDirections/MBRouteStep.swift +++ b/MapboxDirections/MBRouteStep.swift @@ -1032,7 +1032,7 @@ internal class RouteStepV4: RouteStep { let maneuverType = ManeuverType(v4Description: maneuver["type"] as! String) ?? .none let maneuverDirection = ManeuverDirection(v4TypeDescription: maneuver["type"] as! String) ?? .none let maneuverLocation = CLLocationCoordinate2D(geoJSON: maneuver["location"] as! JSONDictionary) - let drivingSide = DrivingSide(description: json["driving_side"] as! String) ?? .right + let drivingSide = DrivingSide(description: json["driving_side"] as? String ?? "") ?? .right let name = json["way_name"] as! String self.init(finalHeading: heading, maneuverType: maneuverType, maneuverDirection: maneuverDirection, drivingSide: drivingSide, maneuverLocation: maneuverLocation, name: name, coordinates: nil, json: json)