Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swift 3.1 warnings #119

Merged
merged 3 commits into from
Mar 30, 2017
Merged

Fix swift 3.1 warnings #119

merged 3 commits into from
Mar 30, 2017

Conversation

bsudekum
Copy link

Fixes Swift 3.1 warnings when using xcode 8.3.

/cc @frederoni @1ec5

@@ -557,7 +557,7 @@ open class RouteStep: NSObject, NSSecureCoding {
return nil
}
maneuverType = ManeuverType(description: maneuverTypeDescription)
let maneuverDirectionDescription = decoder.decodeObject(of: NSString.self, forKey: "maneuverDirection") as! String
let maneuverDirectionDescription = decoder.decodeObject(of: NSString.self, forKey: "maneuverDirection")! as String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, how’d this ! get here in the first place? This line should read:

guard let maneuverDirectionDescription =  as String? else { return nil }

An init?(coder:) method should be able to fail gracefully (hence the ?), because it could be passed absolutely any object for perfectly legitimate reasons.

Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ef1f28b fixes additional warnings in test code.

@bsudekum bsudekum merged commit 9615a66 into master Mar 30, 2017
@bsudekum bsudekum deleted the 3.1-updates branch March 30, 2017 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants