Mgj
07/09/2020, 1:18 PMval view: UITextField
view.addTarget(target = view, action = ::onTextChanged, forControlEvents = UIControlEventEditingChanged)
But its not allowed because Required: COpaguePointer? Found: KFunction0
Apparently theres an toCPointer()
function? I cant seem to import it, so im unsure how its to be usedKris Wong
07/09/2020, 1:36 PMaddTarget(
target = this@FeatureDataSource,
action = sel_registerName("onFeatureToggled:"),
forControlEvents = UIControlEventValueChanged
)
Mgj
07/09/2020, 1:38 PMsel_registerName
but im not sure how to do closures with it. For example i'd like to pass my own extra argument to it, is that possible?Kris Wong
07/09/2020, 1:39 PMMgj
07/09/2020, 1:40 PMaction
argument seems to accept a pointer and if thats true i should be able to include any closures i want if im able to pass an arbitrary function pointersel_registerName
is the only way to do it 😕Kris Wong
07/09/2020, 1:43 PM@ObjCAction fun
or it will crash at runtimeMgj
07/09/2020, 1:43 PMKris Wong
07/09/2020, 1:44 PMMgj
07/09/2020, 1:45 PMonEach
in swift so i figured i'd try to do the binding in kotlin