hello does any one know how to make the UI Fill Un...
# multiplatform
j
hello does any one know how to make the UI Fill Under the status bars in IOS , it works perfectly on android but i get a white color in status bard on IOS
👍 1
m
I think you need to put the map in a Box that uses fillMaxSize modifier and let the map use it as well
j
i did this but the ui didn't fill and it happens only on IOS
e
also multiplatform compose questions should go to #CJLTWPH7S and ios compose questions to #C0346LWVBJ4
s
use this
Copy code
struct ComposeView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> UIViewController {
        MainViewControllerKt.MainViewController()
    }

    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}

struct ContentView: View {
    var body: some View {
        ComposeView()
                .ignoresSafeArea() // Compose has own keyboard handler
    }
}
the palce where the composeView is called in swift call this
Copy code
.ignoresSafeArea()
j
i used the method in this code and it need some small changes and it worked https://kotlinlang.slack.com/archives/C3PQML5NU/p1758661209948769?thread_ts=1758657684.679349&cid=C3PQML5NU
here is the working code inside the ContentView.swift
Copy code
import UIKit
import SwiftUI
import ComposeApp

// This gradient is overlaid on the status bar to ensure text is readable.
let gradient = LinearGradient(
    colors: [
        Color.black.opacity(0.5),
        Color.black.opacity(0.0),
    ],
    startPoint: .top, endPoint: .bottom
)

struct ComposeView: UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> UIViewController {
        // Create the view controller from the KMP module
        let controller = MainViewControllerKt.MainViewController()

        // Force the Compose content to always use a light theme
        controller.overrideUserInterfaceStyle = .light

        return controller
    }

    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}

struct ContentView: View {
    var body: some View {
        ZStack {
            // Display the Compose UI and have it extend into all safe areas
            ComposeView()
                .ignoresSafeArea(.all) // Compose has its own keyboard handler

            // Overlay a gradient on top of the status bar
            VStack {
                gradient.ignoresSafeArea(edges: .top).frame(height: 0)
                Spacer()
            }
        }
            // Set the preferred color scheme for the SwiftUI container to dark
        .preferredColorScheme(.dark)
    }
}