I initially built SwiftUIKitView to create previews for UIKit views quickly. Though, many started using this framework in production code, for which it was not optimized.
I'm happy to announce that this major update adds support to the use of the framework in production apps.
Using a UIKit
view directly in SwiftUI for production code requires you to use:
UIViewContainer(<YOUR UIKit View>, layout: <YOUR LAYOUT PREFERENCE>)
Performance in Previews is less important, it's being redrawn either way.
Therefore, you can use the more convenient swiftUIView()
modifier:
UILabel() // <- This is a `UIKit` view.
.swiftUIView(layout: .intrinsic) // <- This is returning a SwiftUI `View`.