rickclephas/KMP-ObservableViewModel

Cannot inherit from non-open class outside of its defining module

humblehacker opened this issue · 2 comments

The readme claims that it's possible to subclass my view model in Swift:

class TimeTravelViewModel: shared.TimeTravelViewModel {

... but when I try I get the error Cannot inherit from non-open class 'MyViewModel' outside of its defining module. Any advice?

Hi! In order to subclass the ViewModel in Swift you'll need to mark the Kotlin VM as open:

open class TimeTravelViewModel: KMMViewModel()

🤦 Calling Kotlin from Swift has muddied my brain! Thanks and sorry for the noise.