woxtu / UIHostingConfigurationBackport

A backport of UIHostingConfiguration for iOS 14.0+
MIT License
48 stars 3 forks source link

Fix bug where the content is not visible initially #4

Open benlenarts opened 1 year ago

benlenarts commented 1 year ago

When using the backport outside of the context of UICollectionViewCell, I noticed that the result of makeContentView() is an empty view. After setting configuration on that view the SwiftUI content appears.

This behavior is different from UIHostingConfiguration, which shows the SwiftUI content immediately.

This seems to be an oversight, because all it takes to fix this is to trigger the didSet block in the initializer.