I simulate my case in this example:
protocol MyProtocol {
func doSomething()
}
extension MyProtocol {
func doSomething() {
print("Do something")
}
}
class MyViewController: UIViewController, MyProtocol {
let button = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
button.addTarget(self, action: #selector(doSomething), for: .touchUpInside)
}
}
I was expecting that MyViewController
has already implemented doSomething()
function, cause it was implemented in MyProtocol
extension. Unfortunately I'm getting this error:
error: argument of '#selector' refers to instance method 'doSomething()' that is not exposed to Objective-C
Am I able to fix or workaround this?