Hi everyone, can someone help me with how to "over...
# ios
p
Hi everyone, can someone help me with how to "override
layoutSubviews
of the interop
UIView
" as written here? https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-ios-migration.html#onresize-parameter-removed I'm a bit at a loss here, something like
object: UIView() { override fun layoutSubviews(){ /* */ }  }
just leads to a compiler error
a
just create
Copy code
class MyCustomView: UIView() {
    override fun layoutSubview() { ... }
}
May I ask, why do you need to perform manual layout?
p
I don't specifically want to do manual layout. I just hoped it would solve this issue: https://youtrack.jetbrains.com/issue/CMP-7095/blank-camera-preview-screen-with-UIKitView-and-AVCaptureVideoPreviewLayer
a
Yep, you need to create a custom view to manage the
AVCaptureVideoPreviewLayer
p
should I create a bugreport for the compilation error with anonymous object subclassing? or is that expected?
a
The error you're talking about is
Unable to call non-designated initializer as super constructor
is a limitation of Obj-C. You should always override all designated constructors. So the fix will be like:
object: UIView(frame = CGRectZero.readValue()) { override fun layoutSubviews(){ /* */ }  }
p
yes, that worked 🚀 Thanks a lot for your help!