I have a class in swift which implements SRWebSocketDelegate protocol written in objective-c. When I try to implement it's optional method webSocketDidOpen, then I get the following warning:

Also, when I run my code the implementation for webSocketDidOpen is not getting called and the code directly goes to webSocket(_ webSocket: SRWebSocket, didReceiveMessageWith string: String)
How do I implement the optional methods of my protocol written in Objective-C and also get rid of these warnings?
Thanks in advance!
SRWebSocket.his annotatedNS_ASSUME_NONNULL_BEGIN, so by default all values arenonnull. That means that this:Is imported as:
But you implemented:
SRWebSocketis not the same type asSRWebSocket!. Remove the!. This is likely what the rename fixit will do for you.