Replies: 9 comments 1 reply
-
Some parts of the UI do use the MessagingCenter (e.g., Alerts, Prompts, Action Sheets), so it's unlikely that we'd remove that. DependencyService may be changing (there's a spec with a proposal here somewhere, but I don't feel like looking it up just now), but it also provides some UI functionality - at the moment, it handles the native binding services and the dispatcher providers (possibly more). So some version of it will likely remain. |
Beta Was this translation helpful? Give feedback.
-
@hartez I think I may have been misunderstood, I'm suggesting that these be moved to separate packages so that non-forms (erm, non-Maui) apps can use these features without pulling in the entire Forms/Maui dependency, not for them to be eliminated from the codebase. |
Beta Was this translation helpful? Give feedback.
-
If we are going to make an opinionated enhancement with the This provides a few benefits:
|
Beta Was this translation helpful? Give feedback.
-
@ahoefling the MessagingCenter already has an Interface, as you can see here, maybe the case is just clean up and improve the implementation code with new patterns. @alanag13, if we move those items to other packages and the Maui needs to use these packages at the end of the day our projects will have a dependency on those packages... So I think that it would be better to keep them in the MAUI project. |
Beta Was this translation helpful? Give feedback.
-
@pictos I had no idea it had an interface, thanks for sharing the code location |
Beta Was this translation helpful? Give feedback.
-
@pictos I know this doesn't remove a dependency from Maui/Forms.-- the idea is to allow other projects (namely xamarin.android and xamarin.ios projects) to use these features without depending on Maui/Forms. |
Beta Was this translation helpful? Give feedback.
-
@alanag13 Here's the spec I mentioned: #24 If we go that direction (and use Microsoft.Extensions.DependencyInjection) then we'll end up where you're suggesting with regard to DependencyService - it'll be an external dependency that others can use. And it'll be a more full-featured and robust one than the current DependencyService, which to be honest is a little gnarly internally. If we go the route of modifying DependencyService to implement IServiceCollection/IServiceProvider, then it might make sense to move it to a separate package, but I'd still be skeptical - see the aforementioned gnarliness. |
Beta Was this translation helpful? Give feedback.
-
@hartez I'm all for improvements besides just moving them to separate packages and would definitely be in favor of the proposed spec.MessagingCenter also has gnarliness that could similarly be improved upon. |
Beta Was this translation helpful? Give feedback.
-
MessagingCenter is a similar case - the SDK needs it anyway, so we make it available for folks who might need a messaging solution. But it really only includes the features and API that the SDK needs to function. It's a nice "hey, I'm using this SDK and I need simple messaging, I can just use the one that's already here and save myself a dependency" bonus option. It's perfectly functional, but super basic. If we moved it into a separate package, I'm not sure anyone would want to use it - there are so many other options with more features and nicer APIs. It's possible that we could look at other messaging solutions to add as a dependency for this SDK (instead of using MessagingCenter), but what we need internally is very, very basic; anything else might be overkill. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
In my opinion, all features not related directly to creating the UI or responding to its events should be moved to separate packages. MessagingCenter and DependencyService come to mind but I'm sure there are other good candidates.
This would allow Xamarin.iOS and Xamarin. Android projects to use these without pulling in all of Forms/Maui.
Beta Was this translation helpful? Give feedback.
All reactions