Hey guys, I am trying to use interface in swift, b...
# ios
v
Hey guys, I am trying to use interface in swift, but it unable to find the property
commainMain
Copy code
interface ApplicationToken {
    val accessToken: String
    val refreshToken: String
}
iosMain
Platform.kt
Copy code
lateinit var tokenProvider: ApplicationToken
HttpClient.kt
Copy code
actual fun httpClient(config: HttpClientConfig<*>.() -> Unit) = HttpClient(Darwin) {
    config(this)
    engine {
        configureRequest {
            setAllowsCellularAccess(true)
        }
    }
    install(Auth) {
        bearer {
            loadTokens {
                BearerTokens(tokenProvider.accessToken, "")
            }
        }
    }
}
Now when I am to access
tokenProvider
in my swift code. It cannot find. I am adding image please have a look.
message has been deleted
l
Swift doesn't have global variables and functions. Kotlin translates them to static on a class called {filename}Kt, so for example, var bar in Foo.kt translates to FooKt.bar in swift
v
Sure thanks a lot