-
Notifications
You must be signed in to change notification settings - Fork 423
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
[Proposal] Project Reorganization #213
Comments
I see two benefits to rearchitecting the repo:
I prefer to create a new repository for future frameworks such as This means that we would publish two NuGet Packages from this repo:
Here's my recommendation:
Recommended ArchitectureCommunityToolkit/Maui
└───src
│ │ | CommunityToolkit.Maui.sln
│ │
│ └───CommunityToolkit.Maui
│ │ CommunityToolkit.Maui.csproj
│ └───CommunityToolkit.Core
│ | CommunityToolkit.Maui.Core.csproj
│ └───CommunityToolkit.UnitTests
│ | CommunityToolkit.Maui.UnitTests.csproj
└───samples
│ CommunityToolkit.Maui.Samples.csproj |
Will we actually share code between other Toolkits?Looking at the Comet source code, I'm not sure how much code we would be able to share between For example, Comet doesn't use Converters (that's mostly an MVVM/XAML thing), Comet doesn't have Behaviors, Comet uses its own unique Animation implementation and Comet creates its own Controls (e.g. it provides its own implements of If there isn't a future where new toolkits would leverage |
I suggest to keep in CommunityToolkit.Maui.Core only interfaces and base classes, so it will be platform agnostic (net6.0). 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. |
@brminnick I agree with everything in your first comment, I'll apply those changes and push them to my working branch. About the Comet, as you can see here controls are generated using Source Generator, the input needed is the interfaces, so Comet will need just to reference the I'll add @Clancey to add anything else. Expanding a little bit, I believe that any UI framework built on top of .NET MAUI can reference |
I'm not sure if makes sense to restrict one package to be platform agnostic, as you can see here this class lives in Are you suggesting to have three |
@pictos something like this: the idea is to split platforms code from net6.0. for example, validators don't require Android API, so they should not depend on it. from the screenshot, you can see that Controls lib doesn't target net6.0. it means we do not allow people to add this lib to WPF for example. so we do not need to throw exception Platform is not supported. so if I would like to use converters in the WPF application, I can simply reference the project. and use it: As for release, yes, we will have 3 packages. but it doesn't mean we need more effort to support them all. most likely they will be released in the same time in 1 pipeline |
|
@VladislavAntonyuk I'm sorry for the late reply, yesterday was a rush day. So I can see what you mean, and I would say that we don't need more than 2 projects. From the MS.SDK project style all platforms targets have the NET 6 reference, so if we don't want to throw Also, since this project targets specific platforms (mobile and desktop) it's fine, IMHO, that we have platform code on |
@pictos no problem. if we do not include net6.0 in target frameworks we will receive an issue similar to this: xamarin/XamarinCommunityToolkit#1645 Maybe we can rename Core to Shared in that case we receive
|
@VladislavAntonyuk this makes sense to me. Like, if someone references the |
@brminnick @VladislavAntonyuk just pushed the changes based on our conversation. I didn't rename the |
@pictos Could you please provide a definition for Providing a drawing/diagram of the architecture would best help to clarify your vision. I'm still having trouble understanding what belongs into Here's some questions I have for
Recommended ArchitectureHere's my recommended decision chart: `CommunityToolkit.Maui.Core` <- [No] <- "Does it use `Microsoft.Maui.Controls`?" -> [Yes] -> `CommunityToolkit.Maui` Using this, we arrive at this architecture: CommunityToolkit.Maui
└── Alerts (`Snackbar` requires `Microsoft.Maui.Controls.VisualElement`)
└── Behaviors (Requires `Microsoft.Maui.Controls.Behavior<T>`)
└── Converters (Requires `Microsoft.Maui.Controls.IValueConverter`)
└── Extensions (Certain extensions, like `ColorAnimationExtensions` require `Microsoft.Maui.Controls.VisualElement`)
└── Views (Any view that requires `Microsoft.Maui.Controls`, e.g. `Popup.shared.cs`)
CommunityToolkit.Maui.Core
└── Interfaces (E.g. `ISnackbar`)
└── Extensions (Any extension that doesn't require `Microsoft.Maui.Controls`, like `ColorConversionExtensions`)
└── Handlers (All Handlers)
└── Views (Any custom platform-specific views that don't use `Microsoft.Maui.Controls`, e.g. `Popup.ios.macos.cs`, `PopupView.ios.macos.cs`, `Snackbar.ios.macos.cs`, etc) |
Removing the |
@brminnick and @VladislavAntonyuk just a heads up that I updated the description with a more complete information |
Thanks @pictos! The core library will need to be called
It sounds like we're
(Never mind - I misread the Handlers section in 👇 Do you concur with this flow diagram? If so, we should add it to the README and the Contribution Guidelines (FYI - @bijington for when you update them). |
@brminnick I agree with the image. |
The talk, on how comet would work is correct. You would be able to re-use anything in CommunityToolkit.Maui.Core for Comet. So all the handlers should work. If the handlers use interfaces, you can auto generate the comet code! https://github.com/dotnet/Comet/blob/dev/src/Comet/Controls/ControlsGenerator.cs This is how comet actually adds most of its controls! |
Right on! @pictos - When you get a chance, update the Normally, we'd wait to vote until the next standup, but since this is a blocking PR, we can have everyone comment on this Proposal with "Approved" then we'll add the |
@brminnick I will update everything until tomorrow. Anyway I'll ping the team on discord when I do it. |
I vote to Approve ✅ |
1 similar comment
I vote to Approve ✅ |
Approve |
I vote to Approve |
Lets approve this one! |
Reopening Proposal. Only Proposals moved to the |
Project Reorganization
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 likeCommunityToolkit.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 herePrimitives, 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 thisLayout, will be the implementation of ours custom layouts and will use the Layout Managers on
Core
Drawbacks
The text was updated successfully, but these errors were encountered: