Skip to content

Commit

Permalink
Oh, I see what that does now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerrad Thramer committed Dec 8, 2017
1 parent 3c66121 commit fdfe846
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions MapboxDirections/Extensions/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ import Foundation

extension String {
var isNotEmpty: Bool { return !isEmpty }
var nonEmptyString: String? {
return isNotEmpty ? self : nil
}
}
2 changes: 1 addition & 1 deletion MapboxDirections/MBRouteOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ open class RouteOptions: NSObject, NSSecureCoding, NSCopying{
let location = api["location"] as! [Double]
let coordinate = CLLocationCoordinate2D(geoJSON: location)
let possibleAPIName = api["name"] as? String
let apiName = (possibleAPIName?.isEmpty ?? true) ? nil : possibleAPIName!
let apiName = possibleAPIName?.nonEmptyString
return Waypoint(coordinate: coordinate, name: local.name ?? apiName)
}
}
Expand Down

0 comments on commit fdfe846

Please sign in to comment.