how would you pass a selector to an `addTarget` ca...
# kotlin-native
k
how would you pass a selector to an
addTarget
call on a UIControl?
addTarget( target = this, action = sel_registerName("switchChanged"), forControlEvents = UIControlEventValueChanged )
l
So you found the solution?
k
yes 🙂
and you can include a
:
if you want the control to be passed as an argument
l
@Kris Wong Where exactly to put it, and how to receive the control argument?
k
target
is the object on which
action
will be called
in this case, the selector is
@ObjCAction fun switchChanged(switch: UISwitch) {
and action was updated to
sel_registerName("switchChanged:")