Assets
Setup your app icon, fonts and images.
Icons
tip
You can use the Icon Kitchen App to generate all the necessary icon sizes for your apps.
- In Android Studio, you'll need to replace the
mipmap
folder files inandroidApp/src/main/res
with your icons. If you used Icon Kitchen, you can replace allmipmap
folders with the ones in the generated zip. - In Xcode, select the
Assets.xcassets
file and replace each icon with the corresponding one from from your assets or the Icon Kitchen zip file.
Fonts
- Add your custom fonts in .ttf format to the
shared/src/commonMain/composeResources/font
directory. - Go to
shared/src/commonMain/kotlin/com/zenithapps/mobilestack/ui/style/Typography.kt
and add your font to theFontFamily
object with the corresponding weight.
@Composable
private fun getFontFamily() = FontFamily(
Font(resource = Res.font.[YOUR_FONT_NAME], weight = FontWeight.Normal),
Font(resource = Res.font.[YOUR_FONT_NAME], weight = FontWeight.Bold)
)
Images
- Add your images to the
shared/src/commonMain/composeResources/drawable
directory. - Use the
painterResource
function to load the image in your composable.
Image(
painter = painterResource(Res.drawable.[YOUR_IMAGE_NAME]),
contentDescription = "[YOUR_IMAGE_DESCRIPTION]"
)
tip
The easiest way to import images and svgs is to use the Resource Manager in Android Studio. Make sure you move them to composeResources/drawable
after you import them.