Skip to content

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

Merged
daltoniam merged 1 commit into
daltoniam:masterfrom
fassko:ISSUE_399
Oct 16, 2017
Merged

Fixes #399 String.characters.count deprecation warning in Xcode 9.1#400
daltoniam merged 1 commit into
daltoniam:masterfrom
fassko:ISSUE_399

Conversation

@fassko

@fassko fassko commented Oct 9, 2017

Copy link
Copy Markdown
Collaborator

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
Comment thread Sources/WebSocket.swift

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

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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