Skip to content

[Question] Why the ViewModel is a shared code here?Β #148

@chrsp

Description

@chrsp

Hi. First of all, thanks for sharing this repository, It's very useful to help people like me to learning about KMP.

I was reading your code and I have a question about the way the structure is built. In your ViewCotroller class (inside iOS module) you guys are importing the shared module and instantiating the NativeViewModel directly from there. I know that making the VM code shared will make a lot things easier here, because it should behaves exactly equals on both platforms. However, in this scenario, you guys don't need anything that is very specific from iOS frameworks, but, for example, in sometimes I'll need something like a UIColor on my ViewModel, and creating the ViewModel inside the shared code instead of in the iOS code makes it impossible. My question here is: should we actually share the ViewModels classes when working with KMP or it's better to restrict the code sharing to only our Domain layer?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions