在kotlin-multiplatform上生成UUID? [英] Generate UUID on kotlin-multiplatform?
本文介绍了在kotlin-multiplatform上生成UUID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有kotlin-multiplatform通用函数来获取UUID/GUID?
Are there any kotlin-multiplatform common functions to get a UUID/GUID?
// ideally something like this
val newUUID = UUID() // "1598044e-5259-11e9-8647-d663bd873d93"
println("newUUID = $newUUID")
我不希望使用Expect-actual来制作单独的Android和iOS版本.
I'd prefer not to make separate Android and iOS versions using expect-actual.
推荐答案
可能可行 https://github.com/benasher44/uuid
该项目的源代码使用Kotlin Multiplatform项目来实现UUID库.参见 https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html 了解更多详情
The sources of the project use the Kotlin Multiplatform project to implement the UUID library. See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html for more details
这篇关于在kotlin-multiplatform上生成UUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文