Is there a way to expose arrays with explicit type...
# multiplatform
n
Is there a way to expose arrays with explicit type from the common? Currently I’m getting my
List<SomeModel>
converted to
NSArray
with losing the information about it’s type,
SomeModel
a
o
“-Xobjc-generics” - it’s just a partly solution. See my question about generics. https://kotlinlang.slack.com/archives/C3PQML5NU/p1579344665010100
👍 1
n
Ah, I see @Olenyov Kirill. So this is a Swift <-> Objc interop problem. Actually I have an
Observable<List<SomeModel>>
and my use-case is the same as yours with
test2
k
I wrote the generics implementation. There are restrictions imposed by objective-c, such as you can’t have generics on interfaces (protocol in objc). Collection types have special handling in both objc->swift and in how the headers are generated from kotlin. In many general cases they work. You can certainly find cases where generic types are dropped as well.
Observable is an interface. It will not retain generics. That’s an objc problem.
n
Managed to work around the interface problem, with
E/A
for the
Observable
and abstract class instead of interface for the
Observer