Hi! I am using a third party library that is kotli...
# multiplatform
s
Hi! I am using a third party library that is kotlin multiplatform, but I can’t seem to figure out how to import symbols from the library in my Swift code. The library doesn’t export a framework but I expect that I should still be able to import symbols from it since my kotlin code depends on it. The symbols I cannot specifically import are subclasses of a sealed class and extension functions
Copy code
// moduleA of external lib
sealed class Foo

data class FooClazz(val prop: String) : Foo()

// moduleB of my kotlin code; framework shared
fun foo(): Foo = FooClazz(prop = "")

// swift
import shared

struct BarView : View {
    var body: some View {
        let fooValue = sharedFooKt.foo() as! moduleAFooClazz // Cannot find 'moduleAFooClazz' in scope
        Text(fooValue.prop)
    }
}
a
Did you set the dependency as api and added the export on the iOS configuration on the gradle files? Check my blog post, it might help. https://medium.com/teamsnap-engineering/setting-up-a-kmp-shared-library-5f596afc6e09
s
oh! I eventually figured this is what I needed to do. Thank you!
🦜 1