https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
t

Tristan Blakers

12/01/2020, 11:35 PM
does anyone know of a multiplatform URL representation, with basic parsing capability? Ktor has one, but it's too heavy to drag into the browser for just one class...
e

edenman

12/01/2020, 11:37 PM
but really depends on what you need
t

Tristan Blakers

12/01/2020, 11:40 PM
that has the right feature-set, but it seems to be JVM only?
e

edenman

12/01/2020, 11:41 PM
ah yeah, sorry. i include the dep in my
androidMain
, didn’t notice that part
b

Benjamin Charais

12/02/2020, 12:36 AM
As far as existing libraries, Ktor is really what we have for common. Though, I don’t think that building a simple wrapper with expect/actual would be a huge deal.
t

Tristan Blakers

12/02/2020, 12:37 AM
yeah I was thinking of pulling the KTor url class out into its own package with expect/actual - was hoping someone else had bumped into this already 🙂
b

Benjamin Charais

12/02/2020, 12:40 AM
What platforms are you targeting?
t

Tristan Blakers

12/02/2020, 12:40 AM
JVM and JS
b

Benjamin Charais

12/02/2020, 12:43 AM
I assume you really just need stuff like…. and this is probably way more than needed
t

Tristan Blakers

12/02/2020, 12:43 AM
that's it - really just the ability to represent a URL, and parse one from a String
*represent the components of a URL
b

Benjamin Charais

12/02/2020, 12:50 AM
I think that relying on actuals without external libs will be your easiest fastest implementation
👍 1
Sadly — one of the (sometimes fun) pains of us using kotlin in the state it is. I had to do this not long ago for a File representation between iOS, mac, JVM, and Android - that had some Unexpected nonsense.
t

Tristan Blakers

12/02/2020, 12:52 AM
good treeshaking in the browser might be able to solve this - ktor is just too heavy to use in JS, unless you really need the functionality
b

Benjamin Charais

12/02/2020, 12:53 AM
And… in my experience a lot of their builders and internal tools don’t work. That can be a real pain to trace back