Why App Icons and Splash Screens Need Platform-Specific Setup
Even though KMP and Compose Multiplatform help unify business logic and some UI elements across platforms, setting up a splash screen or app icon requires platform-specific configurations. These features are loaded before the shared code kicks in, so they depend on native code and project settings.💡 Note: This setup doesn’t involve Kotlin Multiplatform code, as it runs before any shared code is initialized.
Graphic Assets 📲
- App Icon: On the left 2nd one, we have a complete app icon with a logo and background color. This is used as a single-layer icon on iOS. Icons should ideally be created at a high resolution of 1024x1024 pixels.
- Two-Layer App Icon (Android): On the right, we separate the logo from the background. Android requires app icons to consist of two layers — a foreground (logo) and a background color layer. This adds flexibility, as the app icon shape can adapt to different device preferences, such as circular or square icons. Those are 512x512 pixels. Export individual layers — the background as SVG and the logo itself as PNG or SVG if scalable assets are preferred. Android’s two-layer approach adds customization options, so ensure your assets align with these requirements.
iOS Setup
Setting Up the App Icon
On iOS, app icons are managed within Xcode. When creating an iOS project within a KMP setup, the following steps should help you set up the icon:
1. Open iOS Project: Open/iosApp/iosApp.xcodeproj
in Xcode.
2. Add Icon Assets: In Xcode, go to the
Assets.xcassets
folder. Here, you’ll find an
AppIcon
entry.
3. Drag and Drop Icons: Prepare your app icon image in 1024x1024 pixel size and drag them into the appropriate slots under
AppIcon
. Xcode will display placeholders for each size
(if required for different screen resolutions).
Setting Up the Splash Screen
iOS uses a “Launch Screen” for splash functionality, which loads before the main app content. CreateStoryboard Launch Screen file gist link : https://gist.github.com/wh173d3v11/19be67692ebacf35f8c3fd40ced2ae2b
4.2 In the Custom iOS Target Properties section, Click the Add button (+) and set key as "Launch screen interface file base name".
Android Setup
Setting Up the App Icon
Setting Up the Splash Screen
build.gradle.kts
for the composeApp
module and
add the SplashScreen dependency.
values/themes.xml
.
Here’s an example:
MainActivity
, add the
installSplashScreen()
call to handle the splash screen:
For more detailed instructions, refer to the Android core-splashscreen documentation.
That's all for Android.
Wrapping Up
By setting up the splash screen and app icon natively on each platform, we’re ensuring the app’s first impression matches user expectations. While KMP and Compose Multiplatform are powerful tools for cross-platform development, some aspects, like splash screens and app icons, are better handled with platform-specific solutions. With this guide, you’re set to create a polished, consistent launch experience on both Android and iOS!
Stay Connected:🚀
Stay connected on LinkedIn — for the latest updates. Let’s continue shaping the future of tech together. Happy coding!
Post a Comment