I am attempting to make use of Compose Multiplatform UI in an iOS Share Extension, however the Compose content material solely exhibits a clean white display. Here is what I’ve noticed:
The UIViewController
is sized appropriately (the display background is black with out Compose).
My composable works wonderful in the principle iOS app (it is simply fullscreen crimson Field).
I’m embedding the Compose view like this:
class ShareViewController: UIViewController {
override func viewDidLoad() {
tremendous.viewDidLoad()
print("ShareViewController loaded")
view.backgroundColor = UIColor.systemBackground
let debugLabel = UILabel()
debugLabel.textual content = "UIKit Label: Debugging Structure"
debugLabel.textAlignment = .middle
debugLabel.backgroundColor = UIColor.systemYellow
debugLabel.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(debugLabel)
NSLayoutConstraint.activate([
debugLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
debugLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor),
debugLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor),
debugLabel.heightAnchor.constraint(equalToConstant: 150)
])
let composeVC = MainViewControllerKt.ShareExtensionViewController()
addChild(composeVC)
view.addSubview(composeVC.view)
composeVC.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
composeVC.view.topAnchor.constraint(equalTo: debugLabel.bottomAnchor),
composeVC.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
composeVC.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
composeVC.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
composeVC.didMove(toParent: self)
}
}
Is that this some type of rendering limitation in extension or I’m lacking one thing?