Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: reuse ObservableObject from MVVM Community Toolkit #29

Open
hansmbakker opened this issue Sep 2, 2024 · 2 comments
Open

Comments

@hansmbakker
Copy link

I see you added ObservableObject which is also available from the MVVM Community Toolkit.

Reusing the class from that library would allow to maintain less code yourself.

@SirJohnK
Copy link
Owner

SirJohnK commented Sep 4, 2024

2 reasons for this:

  • My ObserableObject utilizes the WeakEventManager that is part of MAUI, in the same way that the ObserableObject in Xamarin Community Toolkit did, which this library is a replacement for. The ObserableObject in MVVM Community Toolkit have no dependence on MAUI and therefore uses the PropertyChangingEventHandler that can lead to memory leaks in some scenarios when events are not unsubscribed.
  • As much as possible I want to avoid dependencies on other libraries and if copied from the MVVM Community Toolkit, I still need to monitor/update that implementation.

I am a big fan of the MVVM Community Toolkit and use it in all my applications, but in this specific case I think I have a good reason to not use it. 😄

I really appreciate the input and that you take the time to make this a better library! 👍

@hansmbakker
Copy link
Author

Aah, I never used WeakEventManager and was not aware of the memory leaks - I'm using WeakReferenceMessenger (without a dependency on maui) but I guess WeakEventManager has a different purpose for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants