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

Fixes #399 String.characters.count deprecation warning in Xcode 9.1 #400

Merged
merged 1 commit into from
Oct 16, 2017

Conversation

fassko
Copy link
Collaborator

@fassko fassko commented Oct 9, 2017

String.characters.count deprecation warnings

String.characters.count deprecation warnings
@fassko fassko changed the title Fixes #399 Fixes #399 String.characters.count deprecation warning Oct 9, 2017
@@ -531,7 +531,7 @@ open class WebSocket : NSObject, StreamDelegate, WebSocketClient, WSStreamDelega
request.setValue("\(url.host!):\(port!)", forHTTPHeaderField: headerWSHostName)

var path = url.absoluteString
let offset = (url.scheme?.characters.count ?? 2) + 3
let offset = (url.scheme?.count ?? 2) + 3
Copy link

Choose a reason for hiding this comment

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

This change will break for anyone not yet on Xcode 9. Might be best to do the following instead:

#if swift(>=3.2)
let offset = (url.scheme?.count ?? 2) + 3
#else
let offset = (url.scheme?.characters.count ?? 2) + 3
#endif

Copy link

Choose a reason for hiding this comment

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

Nevermind just saw we're already Swift 4 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This deprecation message actually is only in Xcode 9.1 but let's get ready for it. ;)

@fassko fassko changed the title Fixes #399 String.characters.count deprecation warning Fixes #399 String.characters.count deprecation warning in Xcode 9.1 Oct 10, 2017
@daltoniam
Copy link
Owner

Thanks! Let us get ahead of the curve for once 😄.

@daltoniam daltoniam merged commit bf24825 into daltoniam:master Oct 16, 2017
@fassko fassko deleted the ISSUE_399 branch October 16, 2017 18:49
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.

3 participants