[Proposal] Project Reorganization
See original GitHub issueProject Reorganization
- Proposed
- Prototype: Not Started
- Implementation
- iOS Support
- Android Support
- macOS Support
- Windows Support
- Unit Tests
- Sample
Link to Discussion
Summary
We will change the project structure to mimic the .NET MAUI structure, placing all code that doesn’t use Microsoft.Maui.Controls
into a new project, CommunityToolkit.Maui.Core
.
This creates a new NuGet Package, CommunityToolkit.Maui.Core
that new Toolkits like CommunityToolkit.Comet
can leverage.
Motivation
Make our implementation as close as possible from .NET MAUI implementation, which will make it possible to easily support frameworks that are built on top of .NET MAUI and promote our features to the .NET MAUI.
Detailed Design
CommunityToolkit.Maui.Core
In general, this project will have all the basement to develop our Toolkit, including some primitive types, interfaces and base classes, base views, and common code. This will be referenced by other Frameworks/Toolkit based on .NET MAUI that wants to have the same features that us.
Here we will have some:
-
BaseViews, could be
Views
that will be used by other Views, likePaddingButton
(that’s used by Snackbar) or theMCTPopup
that will be a native control implemented in a way that can work with our handler. This same approach is used here -
Primitives, which will be base types that can be used by everyone, like our
MathOperator
. So other frameworks may not have the concept ofBehavior
orConverter
but they can mimic them as helper classes/methods and use our primitives. -
Common Code, this will be all generic code (platform-specific or not) that can be used by other Frameworks/Toolkits
-
Layout Managers, were introduced on .NET MAUI and they live on
Microsoft.Maui.Core
so makes sense to have our managers onCore
as well. -
Handlers, on Core will be the most general Handler with the majority of features.
CommunityToolkit.Maui:
This project has a reference to the Core
project. Here will live the implementation of our Controls, Views, Behaviors, Animations, etc. In other words, this project will work with the .NET MAUI and will be MVVM friendly. Also, other Toolkits/Frameworks can reference this package if needed.
Here we will have some:
-
View Implementation, with
BindableProperties
, support to attach effects, behaviors, triggers, and all that jazz. -
Platform Configuration, that is Platform-specific features, that can relate to some control - like the
ArrowDirection
that is part of Popup and works just on iOS - or the application itself - like theStatusBarColorEffect
from XCT. -
Handlers Implementation, We will add to our
PropertyMapper
and/orCommandMapper
any Platform Configuration that some Handler/View may have. We also can implement here some features that we think will not be great to have onCore
. Here is a reference for this -
Layout, will be the implementation of ours custom layouts and will use the Layout Managers on
Core
Drawbacks
- Adds an additional NuGet packages
- Requires adjustments to the CI Pipeline to publish two Nuget Packages
- Additional dependencies increase compilation
- Reorganizing the entire project may lead to unintentional breaking changes
- This work requires touching every file; some files may be forgotten, some files may be miscopied
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:25 (12 by maintainers)
Top GitHub Comments
I suggest to keep in CommunityToolkit.Maui.Core only interfaces and base classes, so it will be platform agnostic (net6.0). We put ISnackbar, BaseAnimation, IValidator etc here.
Then CommunityToolkit.Maui contains animations, converters, validators, but not Controls (Views). So it can be net6.0 as well. This library doesn’t need UseCommunityMauiToolkit().
Finally CommunityToolkit.Maui.Controls implementation contains only controls and depends on Platforms.
Lets approve this one!