Vivek Modi
05/05/2022, 12:59 PMcommainMain
interface ApplicationToken {
val accessToken: String
val refreshToken: String
}
iosMain
Platform.kt
lateinit var tokenProvider: ApplicationToken
HttpClient.kt
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.Vivek Modi
05/05/2022, 1:07 PMclass getToken : ApplicationToken {
let accessToken: String = ""
let refreshToken: String = ""
}
_ = getToken()
but it giving me error.russhwolf
05/05/2022, 3:38 PMtokenProvider
is a top-level property in Platform.kt, then it will appear in Swift as PlatformKt.tokenProvider
.Vivek Modi
05/05/2022, 5:48 PM