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

Michal Klimczak

12/28/2020, 3:19 PM
is there any pattern for faking Kotlin classes exposed to Swift? Let's say I have
LoadUserUseCase
in my Kotlin shared code. In Swift i have a
UserViewModel
which has the usecase injected. Now i want to write tests for this ViewModel, so I need to create a fake. But there is no protocol to conform to and of course
Cannot inherit from non-open class 'LoadUserUseCase' outside of its defining module
r

russhwolf

12/28/2020, 3:26 PM
Make
LoadUserUseCase
an interface instead of a class. It will translate to Swift as a protocol you can implement.
m

Michal Klimczak

12/28/2020, 3:27 PM
ha, I just started to do that, but didn;t know if it would work, thank you!
8 Views