Hello, I'm working on a project using SKIE and wou...
# touchlab-tools
z
Hello, I'm working on a project using SKIE and would like to make a Kotlin sealed class conform to Swift's
Identifiable
protocol. What's the best way to achieve this without adding an
id
property directly to the Kotlin sealed class? Are there other good options?
t
Classes can be made
Identifiable
simply by conforming to the protocol, so you can add:
Copy code
extension YourKotlinClass: Identifiable { }
into your Swift code and it'll work. It makes it identifiable by it's identity, so two class instances differ if their
===
returns false. You can use SKIE's Swift bundling to add this directly into
iosMain/swift
so you don't have to deal with it on the iOS side.