Rest assured, I didn't get far from my previous qu...
# multiplatform
m
Rest assured, I didn't get far from my previous question and have run into a problem that looks the same to me, again no easy solution available from what I tried to look up, searching this channel doesn't bring anything useful I have commonMain defined sources like
Copy code
interface Middleware<S : State> {
    fun interfere(
        store: Store<S>,
        next: Dispatch<Action>,
    ): Dispatch<Action>
}
I am trying to put a few of middleware instances available into a list like so
Copy code
let container: RootEffectContainer
    let effects: [Effect]
    let middleware: [Middleware<RootState>]
    
    init() {
        container = RootEffectContainer()
        effects = container.effects()
        middleware = [
            ActionEffectMiddleware<RootState>(effects: effects),
            EventEffectMiddleware<RootState>(effects: effects)
        ]
    }
And that gets me an error
Copy code
Protocol 'Middleware' does not have primary associated types that can be constrained
Maybe I am completely missing the point of what KMP stands for but I was under the impression the general idea is to be able to write domain logic once, so it's testable and the same and then branch off into separate implementation for how to use this logic depending on the platform. But it seems like it's easy only on a contrived demo example
e
Kotlin exports to Objective-C, not Swift directly (that is a huge project, https://youtrack.jetbrains.com/issue/KT-64572/The-first-public-release-of-Swift-Export)
as such, generics are only partially supported across languages https://kotlinlang.org/docs/native-objc-interop.html#generics
m
We continue to expand the range of declarations and types supported by Swift export. We have added basic support for:
Copy code
List, Map and Set types.
Is there a good source that goes the critical stuff? Other question I have is this a permanent limitation or there is a project to make Kotlin<->Swift interop direct? If so, is there any link to see the progress?
e
I linked a ticket above
1
as for what they'll do beyond that… don't know
m
I think I could get some answers looking through actual projects but most of what I could find doesn't really cut it for a full-fledged production Are you by chance aware of any open source application/libraries that use KMP, share code and access common code from Swift?
e
I've not used any of them myself but I believe Touchlab has several products around the area of Kotlin/Swift integration
👍 1