I am failing to address what seems to be a basic e...
# multiplatform
m
I am failing to address what seems to be a basic example Here's my
commonMain
definition and implementation of certain interface
Copy code
fun interface EffectContainer {
    fun effects(): Set<Effect>
}

class RootEffectContainer : EffectContainer {
    override fun effects() = emptySet<Effect>()
}
I am trying to create an instance of a
RooEffectContainer
from Swift in
iosMain
and get the error
Copy code
Type 'any Effect' does not conform to protocol 'Hashable'
From a quick lookup there doesn't seem to be a simple solution to what seems to an extremely basic use case. What am I missing? Is there a quick way to enable the protocol Hashable for Kotlin interface? Is there a way to mitigate this issue?
c
m
That thread is over 3 years old, I did read through it, my question is whether this basic use case still hasn't been addressed
c
I guess it cannot be address by the nature how swift `Set`s are defined.
👍 1
m
And on the same note I wonder what searching this channel can help with, the thread ends with OP saying nothing they tried works. I am not sure about the tone of your message too, do you mean it in a way that I shouldn't ask questions like that? Why can't I get the benefit of a doubt that did look through the channel? I am obviously new to multiplatform (and for a good reason, one can't afford to waste their time on half baked demos) and within 30 minutes of setting up a project I am running into a problem that seems extremely basic. Google search doesn't list anything useful so I come into this slack workspace (dedicated to Kotlin) to ask a question about Kotlin. I obviously went and looked through the history, as well as having been through that thread already through Google search. I guess one must look up that 2022 thread and just decide to wait 3 more years instead of asking a question here?
I guess it cannot be address by the nature how swift `Set`s are defined.
I can understand this, I am just wondering if there is any interop that doesn't involve creating a ton of wrappers
As it seems that any time you want to use a data structure like Set to hold interfaces you will run into it
c
Exactly.
👍 1