diff --git a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt index 60b950775e..26de598b2b 100644 --- a/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt +++ b/components/resources/library/src/iosMain/kotlin/org/jetbrains/compose/resources/Resource.ios.kt @@ -5,6 +5,7 @@ package org.jetbrains.compose.resources +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.addressOf import kotlinx.cinterop.usePinned import platform.Foundation.NSBundle @@ -17,6 +18,7 @@ actual fun resource(path: String): Resource = UIKitResourceImpl(path) @ExperimentalResourceApi private class UIKitResourceImpl(path: String) : AbstractResourceImpl(path) { + @OptIn(ExperimentalForeignApi::class) override suspend fun readBytes(): ByteArray { val absolutePath = NSBundle.mainBundle.resourcePath + "/" + path val contentsAtPath: NSData? = NSFileManager.defaultManager().contentsAtPath(absolutePath) diff --git a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt index becf5343ef..0e4dee9096 100644 --- a/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt +++ b/components/resources/library/src/macosMain/kotlin/org/jetbrains/compose/resources/Resource.macos.kt @@ -5,6 +5,7 @@ package org.jetbrains.compose.resources +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.addressOf import kotlinx.cinterop.usePinned import platform.Foundation.NSData @@ -16,6 +17,7 @@ actual fun resource(path: String): Resource = MacOSResourceImpl(path) @ExperimentalResourceApi private class MacOSResourceImpl(path: String) : AbstractResourceImpl(path) { + @OptIn(ExperimentalForeignApi::class) override suspend fun readBytes(): ByteArray { val currentDirectoryPath = NSFileManager.defaultManager().currentDirectoryPath val contentsAtPath: NSData? = NSFileManager.defaultManager().run {