Skip to main content

Resource Management

Atlas allows the ability to manage resources inside a shared/resources common folder. It then automatically generates implementations for all platforms.

This allows a unified approach for assets, fonts, strings, colors, images, etc, for all platforms.

Getting started

First add the plugin to your project


_3
plugins {
_3
id("io.github.thearchitect123.atlasResourcesGenerator")
_3
}

To generate resources for your project, please make sure to add the xml file into the appropriate folders.

  1. shared/resources/strings/strings.xml
  2. shared/resources/colors/colors.xml
  3. shared/resources/fonts/fonts.xml
  4. shared/resources/images/ (all images are to be placed here, supports all image types)

Your folder structure should like this:

Screenshot 2025-03-30 at 7 04 49 am

Then add the values into your xml files like this:

colors.xml


_7
<Colors>
_7
<color key="black">#000000</color>
_7
<color key="white">#FFFFFF</color>
_7
<color key="primary">#FF5722</color>
_7
<color key="green">#00FF00</color>
_7
<color key="secondary">#03A9F4</color>
_7
</Colors>

strings.xml


_7
<AtlasStrings>
_7
<string key="greeting">Hello there</string>
_7
<string key="farewell">Goodbye</string>
_7
<string key="welcomeMessage">Welcome to the app!</string>
_7
<string key="errorMessage">Something went wrong</string>
_7
<string key="confirm">Are you sure you want to continue?</string>
_7
</AtlasStrings>

You can then access your resources like this (in Android Kotlin):


_8
val myString = AtlasStrings.greeting
_8
val colorResource = AtlasColors.primary
_8
_8
// assuming you have an image file (in the images folder) called myImage.png or myImage.svg
_8
val imageResource = AtlasImages.myImage
_8
_8
// assuming you have a font file called robotoBold.ttf
_8
val fontResource = AtlasColors.robotoBold

You can also directly access the resources in Swift, like this:


_4
val myString = AtlasStrings.companion.greeting
_4
val colorResource = AtlasColors.companion.primary
_4
val imagesResource = AtlasImages.companion.myImage
_4
val fontsResource = AtlasFonts.companion.robotoBold