Stefan Oltmann
11/03/2021, 9:55 AMForEach
on an KotlinArray
, but I get Generic struct 'ForEach' requires that 'KotlinArray<MyType>' conform to 'RandomAccessCollection'
.
Is there any compatiblity layer build in for that?louiscad
11/03/2021, 10:08 AMRandomAccessCollection
protocol via a Swift extension?Stefan Oltmann
11/03/2021, 10:09 AMlouiscad
11/03/2021, 10:10 AMSam
11/03/2021, 11:38 AMextension KotlinArray<T>: RandomAccessCollection {}
That should get you started. It's possible that you won't be able to do that with a generic T and will need to specify your class directly. Generics and protocols can be finicky.ankushg
11/03/2021, 5:52 PM