8.1 C
Canberra
Tuesday, October 28, 2025

kotlin – Compose Multiplatform UI in iOS Share Extension exhibits clean display screen


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 screen. This is what I’ve noticed:

The UIViewController is sized accurately (the display screen background is black with out Compose).
My composable works positive in the primary iOS app (it is simply fullscreen pink 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 = .heart
        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)
    }
}

Sooo, i used to be wandering is that this some sort of rendering limitation in extension or I’m lacking one thing. Perhaps someone managed to get this working.

Thanks for any insights!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles