GCDAsyncUdpSocketDelegate in Swift: @objc func 'self'() -> Self

75 views
Skip to first unread message

GW Rodriguez

unread,
Nov 25, 2019, 9:43:32 AM11/25/19
to CocoaAsyncSocket
Hi all,

I just got CocoaAsyncSocket and I'm having an issue using it in Swift. I have a class that uses the protocol 'GCDAsyncUdpSocketDelgate'. To conform to the protocol I have to implement the self function, but it gives me an error. Here's part of the code:

class Incoming: GCDAsyncUdpSocketDelegate {


    @objc func `self`() -> Self {


        return self


    }

}



The error on the function says two things, "Method cannot be marked @objc because its result type cannot be represented in Objective-C", and "Non-'@objc' method 'self()' does not satisfy requirement of '@objc' protocol 'NSObjectProtocol'".

I have tried putting the protocol in an extension, but got the same error. I also tried removing the '@objc', but that didn't help either. Any ideas?


Thanks,
GW

Scorp

unread,
Jan 3, 2020, 5:38:47 AM1/3/20
to CocoaAsyncSocket
Hi, Set superclass as NSObject and all the stuff it's screaming about will be there by default. I'm trying to get this to run on TCP myself.
Reply all
Reply to author
Forward
0 new messages