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

XCode 9.1 beta string.characters deprication #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SwiftDDP/DDPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extension DDPClient: WebSocketDelegate {

extension DDPClient: WebSocketPongDelegate {
public func websocketDidReceivePong(socket: WebSocketClient, data: Data?) {
heartbeat.addOperation() { self.server.pong = Date() }
heartbeat.addOperation() { self.server.pong = Date() }
}
}

Expand Down Expand Up @@ -219,7 +219,7 @@ open class DDPClient: NSObject {
let numbers = Set<Character>(["0","1","2","3","4","5","6","7","8","9"])
let uuid = UUID().uuidString.replacingOccurrences(of: "-", with: "")
var id = ""
for character in uuid.characters {
for character in uuid {
if (!numbers.contains(character) && (round(Float(arc4random()) / Float(UINT32_MAX)) == 1)) {
id += String(character).lowercased()
} else {
Expand Down
4 changes: 2 additions & 2 deletions SwiftDDP/DDPUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func randomBase64String(_ n: Int = 20) -> String {
let BASE64_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"

for _ in 1...n {
let r = arc4random() % UInt32(BASE64_CHARS.characters.count)
let index = BASE64_CHARS.characters.index(BASE64_CHARS.startIndex, offsetBy: Int(r))
let r = arc4random() % UInt32(BASE64_CHARS.count)
let index = BASE64_CHARS.index(BASE64_CHARS.startIndex, offsetBy: Int(r))
let c = BASE64_CHARS[index]
string += String(c)
}
Expand Down