Sean Keane
Kotlin subclass of Objective C class can't be imported
@ExportObjCClass public class MyView: UIView { private val helloWorldLabel = UILabel() @OverrideInit constructor(coder: NSCoder) : super(coder) @OverrideInit public constructor(frame: CValue<CGRect>) : super(frame) { helloWorldLabel.apply { text = "Hello World" translatesAutoresizingMaskIntoConstraints = false } NSLayoutConstraint.activateConstraints( listOf( helloWorldLabel.centerXAnchor.constraintEqualToAnchor(this.centerXAnchor), helloWorldLabel.centerYAnchor.constraintEqualToAnchor(this.centerYAnchor) ) ) this.addSubview(this.helloWorldLabel) } @ObjCAction fun layoutSubviews() { } }
Kris Wong
A modern programming language that makes developers happier.