Reputation: 3945
I'm developing an iOS application in swift, which socket.io library classes written in objective C.
When I updated the Xcode to 6.3.2, I'm getting lot of errors
@protocol SocketIODelegate <NSObject>
@optional
- (void) socketIO:(SocketIO *)socket didReceiveMessage:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didReceiveJSON:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didReceiveEvent:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket didSendMessage:(SocketIOPacket *)packet;
- (void) socketIO:(SocketIO *)socket onError:(NSError *)error;
- (void) socketIO:(SocketIO *)socket onFailWithError:(NSError *)error;
@end
When I implementing these delegate methods in swift class i'm getting "definition conflicts with previous value"
The implemented delegate methods in swift are like:
func socketIO(socket: SocketIO!, onFailWithError error: NSError!) {}
func socketIO(socket: SocketIO!, onError error: NSError!){}
func socketIO(socket: SocketIO!, didReceiveEvent packet: SocketIOPacket!) {}
How to solve this issue?
Upvotes: 0
Views: 1557
Reputation: 803
Using Xcode 6.3.2 and implementing the delegate methods worked just fine for me.
I could only reproduce the error message you mentioned after reading this SO question here: Unable to overload function in viewDidLoad() in swift
This indeed fails to compile for me with definition conflicts with previous value:
func whatever() {
func socketIO(socket: SocketIO!, onFailWithError error: NSError!) {}
func socketIO(socket: SocketIO!, onError error: NSError!){}
func socketIO(socket: SocketIO!, didReceiveEvent packet: SocketIOPacket!) {}
}
So try to move the implementation of the delegate methods out of another function, hopefully that's the issue on your side too.
Upvotes: 1