I'm just getting started with kotlin so I don't re...
# multiplatform
d
I'm just getting started with kotlin so I don't really want to implement my own at this stage. I like the api of this project and it's well tested but has some dependencies on Java that I'm not quite sure how to resolve (particularly references to Class and Generics) https://github.com/MiloszKrajewski/stateful4k
k
Perhaps you could contact the dev and ask to make the libeary available for multiplatform projects?
It doesn't look like it has any JVM-only dependencies, except for junit but that's handled by
kotlin.test
.
d
Thanks, yeah I did that via submitting an issue to the project. There are dependencies in a few places e.g. usage of java.util.*, @JvmStatic annotations and some generics using java.lang.Class that I'm not yet sure how I would model in Kotlin
k
Kotlin has
KClass
, so that shouldn't be a problem I think? Good luck!
👍 1
o
Or may be use coroutines which are essentially compiled to state machines
l
For state machines, there are a two matches depending on your needs. enums for simple ones. sealed classes that can be nested and include companion objects for more complex ones. Also, maybe coroutines which don't expose a state machine, but are based on one generated at compilation are just what you need