Skip to content

Commit ab56b58

Browse files
committed
rename external variable
1 parent 8e2f478 commit ab56b58

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Socket.IO-client for iOS/OS X.
55

66
##Example
77
```swift
8-
let socket = SocketIOClient(socketURL: "localhost:8080", opts: [.Log(true), .ForcePolling(true)])
8+
let socket = SocketIOClient(socketURL: "localhost:8080", options: [.Log(true), .ForcePolling(true)])
99

1010
socket.on("connect") {data, ack in
1111
print("socket connected")
@@ -26,7 +26,7 @@ socket.connect()
2626

2727
##Objective-C Example
2828
```objective-c
29-
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" opts:@{@"log": @YES, @"forcePolling": @YES}];
29+
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" options:@{@"log": @YES, @"forcePolling": @YES}];
3030

3131
[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
3232
NSLog(@"socket connected");
@@ -120,8 +120,8 @@ Run `seed install`.
120120
##API
121121
Constructors
122122
-----------
123-
`init(var socketURL: String, opts: SocketOptionsSet? = nil)` - Creates a new SocketIOClient. opts is a Set of SocketIOClientOption. If your socket.io server is secure, you need to specify `https` in your socketURL.
124-
`convenience init(socketURL: String, opts: NSDictionary?)` - Same as above, but meant for Objective-C. See Options on how convert between SocketIOClientOptions and dictionary keys.
123+
`init(var socketURL: String, options: SocketOptionsSet? = nil)` - Creates a new SocketIOClient. opts is a Set of SocketIOClientOption. If your socket.io server is secure, you need to specify `https` in your socketURL.
124+
`convenience init(socketURL: String, options: NSDictionary?)` - Same as above, but meant for Objective-C. See Options on how convert between SocketIOClientOptions and dictionary keys.
125125

126126
Options
127127
-------

SocketIOClientSwift/SocketIOClient.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
3232
public private(set) var status = SocketIOClientStatus.NotConnected
3333

3434
public var nsp = "/"
35-
public var opts: SocketOptionsSet?
35+
public var options: SocketOptionsSet?
3636
public var reconnects = true
3737
public var reconnectWait = 10
3838
public var sid: String? {
@@ -57,7 +57,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
5757
/**
5858
Type safe way to create a new SocketIOClient. opts can be omitted
5959
*/
60-
public init(var socketURL: String, opts: SocketOptionsSet? = nil) {
60+
public init(var socketURL: String, options: SocketOptionsSet? = nil) {
6161
if socketURL["https://"].matches().count != 0 {
6262
self.secure = true
6363
}
@@ -66,9 +66,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
6666
socketURL = socketURL["https://"] ~= ""
6767

6868
self.socketURL = socketURL
69-
self.opts = opts
69+
self.options = options
7070

71-
for option in opts ?? [] {
71+
for option in options ?? [] {
7272
switch option {
7373
case .ConnectParams(let params):
7474
connectParams = params
@@ -98,9 +98,9 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
9898
Not so type safe way to create a SocketIOClient, meant for Objective-C compatiblity.
9999
If using Swift it's recommended to use `init(var socketURL: String, opts: SocketOptionsDictionary? = nil)`
100100
*/
101-
public convenience init(socketURL: String, opts: NSDictionary?) {
101+
public convenience init(socketURL: String, options: NSDictionary?) {
102102
self.init(socketURL: socketURL,
103-
opts: SocketIOClientOption.NSDictionaryToSocketOptionsSet(opts ?? [:]))
103+
options: SocketIOClientOption.NSDictionaryToSocketOptionsSet(options ?? [:]))
104104
}
105105

106106
deinit {
@@ -111,7 +111,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient {
111111
Logger.log("Adding engine", type: logType)
112112

113113
let newEngine = SocketEngine(client: self, opts:
114-
SocketIOClientOption.SocketOptionsSetToNSDictionary(opts ?? []))
114+
SocketIOClientOption.SocketOptionsSetToNSDictionary(options ?? []))
115115

116116
engine = newEngine
117117
return newEngine

0 commit comments

Comments
 (0)