Skip to content

Commit a6c7002

Browse files
committed
don't need two inits
1 parent aa368f9 commit a6c7002

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

SocketIOClientSwift/SocketEngine.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,12 @@ public final class SocketEngine: NSObject, SocketEngineSpec, WebSocketDelegate {
7070
private(set) var connected = false
7171
private(set) var polling = true
7272
private(set) var websocket = false
73-
74-
public init(client: SocketEngineClient, sessionDelegate: NSURLSessionDelegate?) {
73+
74+
public init(client: SocketEngineClient, opts: NSDictionary?) {
7575
self.client = client
76-
self.session = NSURLSession(configuration: NSURLSessionConfiguration.defaultSessionConfiguration(),
77-
delegate: sessionDelegate, delegateQueue: workQueue)
78-
}
79-
80-
public convenience init(client: SocketEngineClient, opts: NSDictionary?) {
81-
self.init(client: client, sessionDelegate: opts?["sessionDelegate"] as? NSURLSessionDelegate)
76+
session = NSURLSession(configuration: .defaultSessionConfiguration(),
77+
delegate: opts?["sessionDelegate"] as? NSURLSessionDelegate,
78+
delegateQueue: workQueue)
8279
forceWebsockets = opts?["forceWebsockets"] as? Bool ?? false
8380
forcePolling = opts?["forcePolling"] as? Bool ?? false
8481
cookies = opts?["cookies"] as? [NSHTTPCookie]

SocketIOClientSwift/SocketEngineSpec.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import Foundation
3434
var urlWebSocket: String {get}
3535
var ws: WebSocket? {get}
3636

37-
init(client: SocketEngineClient, sessionDelegate: NSURLSessionDelegate?)
3837
init(client: SocketEngineClient, opts: NSDictionary?)
3938

4039
func close(fast fast: Bool)

0 commit comments

Comments
 (0)