-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide conversion to/from platform specific UUIDs #102
Comments
Conversion ended up being simpler than I had expected, with the caveat that I'm not sure of the performance implications of using JVMfun Uuid.toUUID(): UUID = UUID.fromString(toString())
fun UUID.toUuid(): Uuid = uuidFrom(toString()) Applefun Uuid.toNSUUID(): NSUUID = NSUUID(toString())
fun NSUUID.toUuid(): Uuid = uuidFrom(UUIDString) JavascriptAs far as I can tell, Javascript doesn't have a standard UUID type (they're often taken as plain Strings), so I've been using the provided |
To get at least part of the way towards a more efficient byte-based conversion from |
Hi @twyatt ! I am new to KMM, could you help me ? If I want to use the functions you defined, am I supposed to put them in the kotlin iOSMain and call them from my Swift code in XCode ? |
I use them internally in the Kable library. They are in the Unfortunately I haven't worked much with Swift calling into Kotlin code, so I probably can't help you there much. There is interop documentation that may prove helpful?: |
Libraries that have
Uuid
(provided by this library) on their public API, may need to internally call native APIs that expect or return native UUID representations (e.g.NSUUID
on iOS).It would be helpful to provide platform specific conversions from
Uuid
to native UUID types (e.g.fun Uuid.toNSUUID(): NSUUID
), and visa versa.The text was updated successfully, but these errors were encountered: