Skip to content

Commit

Permalink
fix convenience constructor. Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearace committed Mar 16, 2015
1 parent 68da96f commit 90187aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ import Socket_IO_Client_Swift

API
===
Constructor
Constructors
-----------
`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)
`init(socketURL: String, opts:NSDictionary? = nil)` - Constructs a new client for the given URL. opts can be omitted (will use default values. See example)

`convenience init(socketURL: String, options:NSDictionary? = nil)` - Same as above, but meant for Objective-C. See Objective-C Example.
Methods
-------
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.
Expand Down Expand Up @@ -124,12 +126,12 @@ socket.connect()
Objective-C Example
===================
```objective-c
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" opts:nil];
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" options:nil];

[socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray*)) {
NSLog(@"connected");
[socket emitObjc:@"echo" :@[@"echo test"]];
[[socket emitWithAckObjc:@"ackack" :@[@"test"]] onAck:^(NSArray* data) {
[[socket emitWithAckObjc:@"ackack" :@[@"test"]] onAck:0 withCallback:^(NSArray* data) {
NSLog(@"Got data");
}];
}];
Expand Down
4 changes: 2 additions & 2 deletions Socket.IO-Client-Swift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Socket.IO-Client-Swift"
s.version = "1.1.4"
s.version = "1.1.5"
s.summary = "Socket.IO-client for Swift"
s.description = <<-DESC
Socket.IO-client for Swift.
Expand All @@ -12,7 +12,7 @@ Pod::Spec.new do |s|
s.author = { "Erik" => "[email protected]" }
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v1.1.4' }
s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v1.1.5' }
s.source_files = "SwiftIO/**/*.swift"
s.requires_arc = true
# s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files
Expand Down
6 changes: 3 additions & 3 deletions SwiftIO/SocketIOClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class SocketIOClient: NSObject {
return self._sid
}

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

public convenience init(socketURL:String, opts:NSDictionary?) {
self.init(socketURL: socketURL, opts: opts)
public convenience init(socketURL:String, options:NSDictionary?) {
self.init(socketURL: socketURL, opts: options)
}

// Closes the socket
Expand Down

0 comments on commit 90187aa

Please sign in to comment.