Cysharp / Cysharp/ObservableCollections

SynchronizedView with TView parameters only

Open
#112 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1k
Forks
73
Avg merge
5d 4h
Merged PRs (30d)
2

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the SynchronizedViewChangedEventArgs<T, TView> example in the issue and compare it with the described View.cs and .uxml separation. Determine whether a SynchronizedView exposing only TView fits the existing API, then document the decision and any required API changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.