https://kotlinlang.org logo
#ios
Title
# ios
b

brabo-hi

12/01/2023, 6:57 AM
Hello guys , how to handle UIButton click in a kmm project ios
a

Andrew Reed

12/08/2023, 9:58 AM
many questions, is this a kmm project with jetbrains compose? or are you consuming a kmm project like a library? How do you handle a button click in iOS natively? usually you forward the event to your viewmodel/viewcontroller. The same principle in kmm, the only difference is you pass the event to the kmm view model. So your viewmodel would have a function
Copy code
fun handleButtonClick()
and then in your swiftui you would do
Copy code
viewmodel.handleButtonClick()
3 Views