From f3d771641d9b854f2303c7ee5b6ec5fe6ce4b3c5 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 14 Jul 2016 19:54:09 -0400 Subject: [PATCH] some swift3 changes --- Source/SocketIOClient.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/SocketIOClient.swift b/Source/SocketIOClient.swift index 15ce86e..c7bf771 100644 --- a/Source/SocketIOClient.swift +++ b/Source/SocketIOClient.swift @@ -124,11 +124,12 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable /// Connect to the server. public func connect() { - connect(0, handleWith: nil) + connect(timeoutAfter: 0, withHandler: nil) } - /// Connect to the server. If we aren't connected after timeoutAfter, call handler - public func connect(_ timeoutAfter: Int, handleWith handler: (() -> Void)?) { + /// Connect to the server. If we aren't connected after timeoutAfter, call withHandler + /// 0 Never times out + public func connect(timeoutAfter: Int, withHandler handler: (() -> Void)?) { assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)") guard status != .connected else { @@ -410,6 +411,7 @@ public final class SocketIOClient : NSObject, SocketEngineClient, SocketParsable handlers.removeAll(keepingCapacity: false) } + /// Because Swift 3 removes a lot of implicit briding so we have to perform more casts func socketDataToAnyObject(_ data: [SocketData]) -> [AnyObject] { return data.flatMap({$0 as? AnyObject}) }