Gradle plugin for generating file based on a directory containing the asset files Please note that it’s in experimental status.


Kotlin Multiplatform enables sharing code between various platforms, including iOS. With that said, when creating a multiplatform application, it may also be necessary to share assets between the platforms, such as images and binary resources. The goal of this plugin is to come in handy in case the iOS binary is shared via an XCode framework, as it allows a folder, that is already the basis for resources for other platforms (eg assets on Android or for JAR files) to also be the source of iOS resources.

How it works

The CreateXcAssets task organizes the files into the Resources.xcassets folder, in the same structure XCode would expect it, then run xcrun actool.

Currently two kind of assets are supported:

  • Imageset
  • Dataset

The filter for files determining either the asset type for it (or to skip it) must be provided by the project (see the example code)


Add my repository to the plugin resolution config at settings.gradle.kts:

pluginManagement {
    repositories {

Then you can use it in your project:

plugins {
    id("com.danielgergely.createxcassets") version "0.0.1"

tasks.register<CreateXcAssets>("createXcAssets") {

    resourcesDirectory = File(project.rootDir, "resources")
    fileFilter { file ->
        when {
            file.extension.equals("png", true) -> IMAGE
            else -> DATA

    doLast {
        File(project.buildDir, "XCFrameworks")
            .filter { it.isDirectory &&".framework") }
            .forEach { frameworkDir ->
                carFile.copyTo(File(frameworkDir,, overwrite = true)
}.apply {

In this example, right after the file is created, it is copied to all of the produced frameworks


View Github