I know, that making some methods in a Swift protocol requires to use @objc protocol. The problem is, that I can't use the objective c way, because I have a method in the protocol, which returns a Swift struct. So I'm getting the error, that I can't use the @objc protocol, because my method returns a result, which cannot be represented in objective c.
Unfortunately, I absolutely want to use an optional methods, because there are two methods, which are alternative and the user of my class shall choose, which way he want to use.
What I do in this situation is return a class (compatible with Objective-C) which wraps the Swift struct. In other words, just make it so that everything Objective-C sees is compatible with Objective-C, and inside that you can do anything you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With