I have a custom ViewController delegate class, which handles ui actions such as button clicked and display text in a text view.
Now I want to use AsyncSocket in the
// - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port;
func socket(socket : GCDAsyncSocket, didConnectToHost host:String, port p:UInt16)
// - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag;
func socket(socket : GCDAsyncSocket, didReadData data:NSData, withTag tag:Int32)
Don't forget to make your swift class inherit from NSObject, otherwise the GCDAsyncSocket will fail to assign it as a delegate.
Also, do not mark any parameters as var
as in var didReadData data:NSData