Shared Images, Fonts & Strings
Use compose-resources across every platform.
Shared Images, Fonts & Strings is a free Kotlin Multiplatform Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Multiplatform Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Assets Should Be Shared Too
Your logo, your fonts, your labels: why ship them twice? compose-resources lets every platform load the same assets. 🖼️
One Resources Folder
You drop assets into a shared composeResources directory. Images, fonts and strings all live in one place for every target.
Add the Resources Setup
Enabling resources generates a typed Res object. You reference assets through it instead of raw file paths.
commonMain.dependencies {
implementation(compose.components.resources)
}Folders by Asset Type
Resources are grouped into folders like drawable, font and values. The names tell the toolkit how to treat each file.
Show a Shared Image
Load a drawable with painterResource and the generated Res handle. The same picture renders on both apps.
Image(
painter = painterResource(Res.drawable.logo),
contentDescription = "Logo"
)Bundle a Custom Font
Place a font file in the font folder, then load it with Font and the Res handle to build a FontFamily.
val brand = FontFamily(Font(Res.font.inter_bold))Strings in One File
Define your text in a shared strings.xml. Each label gets a key, and the Res object exposes it to your UI.
<string name="welcome">Welcome back!</string>Read a Shared String
You fetch text with stringResource and the generated key. No more hardcoded labels scattered across screens.
Text(stringResource(Res.string.welcome))Type Safety for Free
Because Res is generated, a typo in an asset name fails to compile. You catch missing resources before users ever do. ✅
Strings Can Take Arguments
Add placeholders in a string and pass values at call time. The same stringResource call fills them in for you.
Text(stringResource(Res.string.greeting, userName))Assets Travel With Shared Code
Because resources live in the shared module, any app that uses your code gets the assets automatically. One source of truth. 🙂
Quick Check
Which function loads a shared drawable into a Compose Image?
Recap: Shared Look and Feel
You stored images, fonts and strings once and loaded them with the generated Res object. Every platform shares the same brand. 🎨
Frequently asked questions
Is the “Shared Images, Fonts & Strings” lesson free?
Yes — the full text of “Shared Images, Fonts & Strings” is free to read here on the web, and the Kotlin Multiplatform Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Kotlin Multiplatform Academy course, upgrade to CoddyKit PRO.
What will I learn in “Shared Images, Fonts & Strings”?
Use compose-resources across every platform. You practise Kotlin Multiplatform Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Kotlin Multiplatform Academy?
No prior experience is required. Kotlin Multiplatform Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Shared Images, Fonts & Strings” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Kotlin Multiplatform Academy lesson?
Yes. Every Kotlin Multiplatform Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Navigate Between Shared Screens
- Pass Arguments & Deep Links
- Shared Images, Fonts & Strings
- Localize Shared UI Text