Skip to content

Commit a7fb0f8

Browse files
committed
Use the same name for objc/swift methods
1 parent 27a7677 commit a7fb0f8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8
2929

3030
[socket on: @"connect" callback: ^(NSArray* data, void (^ack)(NSArray*)) {
3131
NSLog(@"connected");
32-
[socket emitObjc:@"echo" withItems:@[@"echo test"]];
33-
[socket emitWithAckObjc:@"ackack" withItems:@[@1]](10, ^(NSArray* data) {
32+
[socket emit:@"echo" withItems:@[@"echo test"]];
33+
[socket emitWithAck:@"ackack" withItems:@[@1]](10, ^(NSArray* data) {
3434
NSLog(@"Got ack");
3535
});
3636
}];
@@ -103,9 +103,9 @@ Methods
103103
1. `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.
104104
2. `onAny(callback:((event:String, items:AnyObject?)) -> Void)` - Adds a handler for all events. It will be called on any received event.
105105
3. `emit(event:String, _ items:AnyObject...)` - Sends a message. Can send multiple items.
106-
4. `emitObjc(event:String, withItems items:[AnyObject])` - `emit` for Objective-C
106+
4. `emit(event:String, withItems items:[AnyObject])` - `emit` for Objective-C
107107
5. `emitWithAck(event:String, _ items:AnyObject...) -> (timeout:UInt64, callback:(NSArray?) -> Void) -> Void` - Sends a message that requests an acknowledgement from the server. Returns a function which you can use to add a handler. See example. Note: The message is not sent until you call the returned function.
108-
6. `emitWithAckObjc(event:String, withItems items:[AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function.
108+
6. `emitWithAck(event:String, withItems items:[AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function.
109109
7. `connect()` - Establishes a connection to the server. A "connect" event is fired upon successful connection.
110110
8. `connectWithParams(params:[String: AnyObject])` - Establishes a connection to the server passing the specified params. A "connect" event is fired upon successful connection.
111111
9. `close(#fast:Bool)` - Closes the socket. Once a socket is closed it should not be reopened. Pass true to fast if you're closing from a background task.

SocketIOClientSwift/SocketIOClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
280280
/**
281281
Same as emit, but meant for Objective-C
282282
*/
283-
public func emitObjc(event:String, withItems items:[AnyObject]) {
283+
public func emit(event:String, withItems items:[AnyObject]) {
284284
if !self.connected {
285285
return
286286
}
@@ -305,7 +305,7 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketLogClient
305305
/**
306306
Same as emitWithAck, but for Objective-C
307307
*/
308-
public func emitWithAckObjc(event:String, withItems items:[AnyObject]) -> OnAckCallback {
308+
public func emitWithAck(event:String, withItems items:[AnyObject]) -> OnAckCallback {
309309
if !self.connected {
310310
return self.createOnAck(event, items: items)
311311
}

0 commit comments

Comments
 (0)