Skip to content

SynchronizedView with TView parameters only #112

@Svarshick

Description

@Svarshick

I have never worked with mvvm targeted frameworks. I implement mvvm in Unity and learn pattern from articles. So I might be misunderstanding the pattern. Isn't SynchronizedViewChangedEventArgs<T, TView> violates encapsulation "view doesn't know about data" in that example?

        var model = new ObservableList<SomeData>();
        var vm = model.CreateView(data => CreateView(someData)); //generates view for model data
        var view = new ScrollView(); //view has field vm
        vm.ObserveAdd().Subscribe(evt => view.Add(evt.Value.View)); //view observes vm and have acces to the evt.Value.Value (model data)

Currently, I use a View.cs file alongside .uxml to just bind uxml to the code. So I put data related logic in the vm and appearance related logic in the view (drag&drop ScrollView element). This is why view wants to look at vm.SynchronizedView, but access only TView without T. Does it make sense to create TView only SynchronizedView?

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