Hi colleagues, may be I am missing something essential: if I have a multiplatform (lib) project using ktor, am I supposed to configure different Http Clients for each platform? What is a recommended approach here - obviously the library code should not know about which client implementation is used. Should I create it using per-platform function? Somehow I expect this to be basis thing but could not find answer in official ktor/mpp docs.
e
e5l
08/18/2023, 11:16 AM
Hey! You can use
val client = HttpClient()
in common and it will automatically select implementation for every platform, using dependencies
g
Goetz Markgraf
08/18/2023, 11:30 AM
And if you need platform specific additions, you can
expect
a function in the commonSrc and provide an
actual
implementation in each platform specific code.
👍 1
a
Andy Victors
08/18/2023, 2:19 PM
Thank you. Was no aware about automatic implementation so far. Will try this first!