Sterling Albury
02/14/2022, 7:13 AMSet<Foo>
, where Foo
is just a simple interface with a couple of functions defined in commonMain
, and if I try to declare or instantiate this set in swift, I get the error "Type 'Foo' does not conform to protocol 'Hashable'". Is there a way to make my interface Hashable or is there another good way to have sets of my interface?Paul Woitaschek
02/14/2022, 7:16 AMSterling Albury
02/14/2022, 7:18 AMSterling Albury
02/14/2022, 7:27 AMPaul Woitaschek
02/14/2022, 7:38 AMSterling Albury
02/14/2022, 7:44 AMinterface Foo {
fun something()
}
and in my swift code I want to have a set of Foo, like so
var fooSet: Set<Foo>
but this line gives me that error about Foo not being Hashable.
I have implementations of Foo that I want to create the set from, in kotlin and swift, but how do I even declare the set?Paul Woitaschek
02/14/2022, 7:46 AMPaul Woitaschek
02/14/2022, 7:46 AMSterling Albury
02/14/2022, 7:48 AMPaul Woitaschek
02/14/2022, 7:50 AMSterling Albury
02/14/2022, 7:55 AMSet<Foo>
, I can't use it in swift? It's actually going to be pretty rough to try and change that data structureSterling Albury
02/14/2022, 7:57 AMSterling Albury
02/14/2022, 10:17 AM'KotlinArray' is ambiguous for type lookup in this context
..any idea what that's about?Grégory Lureau
02/14/2022, 10:29 AMAny
functions. I presume that Any enforce those methods but you could pass an instance from Swift that doesn't matches those requirements.Grégory Lureau
02/14/2022, 10:30 AMinterface Foo {
override operator fun equals(other: Any?): Boolean
override fun hashCode(): Int
}
russhwolf
02/14/2022, 1:45 PMextension Foo: Hashable
in Swift.Sterling Albury
02/14/2022, 6:37 PMextension Foo : Hashable
I get an error "Extension of protocol 'Foo' cannot have an inheritance clause".