3

I've created a sample Kotlin/Native iOS app using AppCode. It runs perfectly fine. The sample app contains one UILabel, one UITextField and a Button. When the user clicks the button, the textfield data will be shown in the label.

Now, I've added a new button using XCode's InterfaceBuilder, but I don't know how to connect the button to the ViewController.kt file. Usually, when using Swift, a simple drag and drop from the InterfaceBuilder to the Swift file would automatically make the connection. But in my case it's not a Swift file, but Kotlin.

How do i make the connection to the Kotlin view controller file from the InterfaceBuilder ? I tried the drag and drop, but it doesn't work.

I tried manually editing the storyboard file using a text editor and added the connection. It did work. but I don't feel like it as a perfect solution. Is there any alternative?

Below given the screenshot of the App.

Here's the github link for the source code.

Sample app

theapache64
  • 10,926
  • 9
  • 65
  • 108

0 Answers0