AvdLee / SwiftUIKitView

Easily use UIKit views in your SwiftUI applications. Create Xcode Previews for UIView elements
https://www.avanderlee.com
MIT License
766 stars 24 forks source link

`UILabel` Preview Example not working #9

Open MarcoEidinger opened 2 years ago

MarcoEidinger commented 2 years ago

UILabel Preview Example in project SwiftUIKitExample.xcodeproj does not work.

        UILabel() // <- This is a `UIKit` view.
            .swiftUIView(layout: .intrinsic) // <- This is a SwiftUI `View`.
            .set(\.text, to: "Hello, UIKit!") // <- Use key paths for updates.
            .fixedSize() // <- Make sure the size is set
            .previewLayout(.sizeThatFits)
            .previewDisplayName("UILabel Preview Example")
    }

Expected to see the text "Hello, UIKit!" but that text is not visible in the preview :(

https://user-images.githubusercontent.com/4176826/193900800-b6b01da1-5898-43b8-a3a8-2606e380f04c.mov

Tested with Xcode 14.0.1 and iPhone 13 (iOS 16) simulator

gcohen-dev commented 1 year ago

I think it's working on Xcode 14.