compose-richtext icon indicating copy to clipboard operation
compose-richtext copied to clipboard

Use the pure kotlin UUID for multiplatform compatibility

Open bpappin opened this issue 1 year ago • 3 comments

in file: com.halilibo.richtext.ui.util.UUID.kt You have it set up as an expect/actual, which means that you need to implement it for each platform.

If you replace the platform specific code with the pure kotlin: Uuid.random().toString() when you dont need to implement it for all of them.

package com.halilibo.richtext.ui.util

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

@OptIn(ExperimentalUuidApi::class)
internal fun randomUUID(): String = Uuid.random().toString()

bpappin avatar Dec 30 '24 21:12 bpappin

FYI I am porting for my multiplatform project now, because its not behaving as is.

bpappin avatar Dec 30 '24 21:12 bpappin

unfortunately a library should not depend on another library's experimental APIs. Although we are not concerned with the binary/source compatibility before we reach 1.0.0, let's get back to this when we are crossing that bridge.

halilozercan avatar Jul 07 '25 22:07 halilozercan

I think that is a bit of a stretch. Half the Kotlin ecosystem is tagged as experimental. I would be very surprised if there isn't one of those tags in this code.

Use of the Java UUID class is depending on a whole different platform, and the sooner we get Java out of our kotlin code, the better.

bpappin avatar Jul 09 '25 01:07 bpappin