Hey guys! I have made this simple PokeDex app and ...
# compose-ios
s
Hey guys! I have made this simple PokeDex app and I was wondering, can I change the color of the top bar in iOS? If possible per screen. Now I have this white bar, which should be blue
👀 1
👍 2
k
NB: screenshots in readme are outdated 🙂
image.png,image.png
s
Where do they exactly set the color?
k
it is not color but the right handling insets
technically it is padding in the toolbar
s
The padding is only there for the iOS target then?
k
for all platforms
image.png
s
Oke, I will try it out!
k
If you want an easy and fast fix, just put a box with a color background into your root composable
k
But with no success
k
cc @Mori Atsushi
s
I missed the part in the MainActivity 😅
How do i combine this with PreCompose?
Copy code
fun MainViewController(): UIViewController {
    initKoin()
    return PreComposeApplication(title = "") {
        App()
    }
}
I found this article: https://betterprogramming.pub/jetpack-compose-for-ios-getting-started-step-by-step-e7be6f52edd4 And I copied there iosApp.swift code and that works
Copy code
//iosApp.swift

import SwiftUI
import shared

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        window = UIWindow(frame: UIScreen.main.bounds)
        let mainViewController = Main_iosKt.MainViewController()
        window?.rootViewController = mainViewController
        window?.makeKeyAndVisible()
        return true
    }
}
@Mori Atsushi There is probably a better way?
a
@Stefan de Kraker any luck?