Skip to content

Commit 90187aa

Browse files
committed
fix convenience constructor. Bump version
1 parent 68da96f commit 90187aa

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ import Socket_IO_Client_Swift
3838

3939
API
4040
===
41-
Constructor
41+
Constructors
4242
-----------
43-
`init(socketURL: String, opts:[String: AnyObject]? = nil)` - Constructs a new client for the given URL. opts can be omitted (will use default values. See example)
43+
`init(socketURL: String, opts:NSDictionary? = nil)` - Constructs a new client for the given URL. opts can be omitted (will use default values. See example)
44+
45+
`convenience init(socketURL: String, options:NSDictionary? = nil)` - Same as above, but meant for Objective-C. See Objective-C Example.
4446
Methods
4547
-------
4648
1. `socket.on(name:String, callback:((data:NSArray?, ack:AckEmitter?) -> Void))` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example.
@@ -124,12 +126,12 @@ socket.connect()
124126
Objective-C Example
125127
===================
126128
```objective-c
127-
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" opts:nil];
129+
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" options:nil];
128130

129131
[socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray*)) {
130132
NSLog(@"connected");
131133
[socket emitObjc:@"echo" :@[@"echo test"]];
132-
[[socket emitWithAckObjc:@"ackack" :@[@"test"]] onAck:^(NSArray* data) {
134+
[[socket emitWithAckObjc:@"ackack" :@[@"test"]] onAck:0 withCallback:^(NSArray* data) {
133135
NSLog(@"Got data");
134136
}];
135137
}];

Socket.IO-Client-Swift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Socket.IO-Client-Swift"
3-
s.version = "1.1.4"
3+
s.version = "1.1.5"
44
s.summary = "Socket.IO-client for Swift"
55
s.description = <<-DESC
66
Socket.IO-client for Swift.
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212
s.author = { "Erik" => "[email protected]" }
1313
s.ios.deployment_target = '8.0'
1414
s.osx.deployment_target = '10.10'
15-
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v1.1.4' }
15+
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v1.1.5' }
1616
s.source_files = "SwiftIO/**/*.swift"
1717
s.requires_arc = true
1818
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files

SwiftIO/SocketIOClient.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class SocketIOClient: NSObject {
7474
return self._sid
7575
}
7676

77-
public init(var socketURL:String, opts:[String: AnyObject]? = nil) {
77+
public init(var socketURL:String, opts:NSDictionary? = nil) {
7878
if socketURL["https://"].matches().count != 0 {
7979
self._secure = true
8080
}
@@ -116,8 +116,8 @@ public class SocketIOClient: NSObject {
116116
self.engine = SocketEngine(client: self, forcePolling: self.forcePolling)
117117
}
118118

119-
public convenience init(socketURL:String, opts:NSDictionary?) {
120-
self.init(socketURL: socketURL, opts: opts)
119+
public convenience init(socketURL:String, options:NSDictionary?) {
120+
self.init(socketURL: socketURL, opts: options)
121121
}
122122

123123
// Closes the socket

0 commit comments

Comments
 (0)