"Use of unresolved identifier" using the new Swift 2.2 syntax for selectors on implicit setter

Viewed 1697

Migrating my code to Swift 2.2, I have a property var activeTextField:UITextfield? and the selector I was using was "setActiveTextField:". This method does not exist explicitly in my swift code.

With the new syntax, #selector(setActiveTextField) doesn't work: Use of unresolved identifier

I know I could use Selector("setActiveTextField:") but I'd loose the benefit of the new swift selectors.

So, what's the new way of doing this?

2 Answers

In Swift 3, SE-0064 was accepted to solve this problem. Now, you would generate that setter like so:

#selector(setter: activeTextField)
Related