I've added atomicfu to project like this in common...
# multiplatform
m
I've added atomicfu to project like this in commonMain
Copy code
compile "org.jetbrains.kotlinx:atomicfu-common:0.14.4"
now my build on ios fails, any suggestion
Copy code
Execution failed for task ':shared:compileKotlinIos'.
 > Could not resolve all files for configuration ':shared:iosCompileKlibraries'.
    > Could not resolve org.jetbrains.kotlinx:atomicfu-common:0.14.4.
      Required by:
          project :shared
       > No matching variant of org.jetbrains.kotlinx:atomicfu-common:0.14.4 was found. The consumer was configured to find a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but:
           - Variant 'metadata-api' capability org.jetbrains.kotlinx:atomicfu-common:0.14.4:
               - Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
               - Other compatible attribute:
                   - Doesn't say anything about org.jetbrains.kotlin.native.target (required 'ios_x64')
           - Variant 'metadata-commonMainMetadataElements' capability org.jetbrains.kotlinx:atomicfu-common:0.14.4 declares a usage of 'kotlin-api' of a component:
...
m
@Mikołaj Kąkol this may not help you, but I was looking at using atomicfu just yesterday, before realizing that
kotlinx.coroutines
had the mutex and semaphore implementations I needed, and were better for my use case.
m
In my case I need to set some value after object has been frozen. However you might be right, seeking solutions elsewhere. a mutable state flow could be a good replacement while atomic is not working for me.
m
@Mikołaj Kąkol I especially went this route because the documentation and support for atomicfu all but says "this is something we use for ourselves in jetbrains and intend it to change quite a bit".
Whereas
kotlinx.coroutines
is stable which is super appealing.
Even if it means more work in the short run for something like what you're trying to do.