TemplateStudio
TemplateStudio copied to clipboard
Define xPlatform app architecture
Consider:
- Reusability
- Complexity
- Best practices, ...
Figure out which changes will require the current code (if it will be needed to be shared with the xPlat stuff). We found the following approximation:
- Do not use .NET Standard as it will require UWP 16299 as min target
- We will try to predefiene an architecture which allows to share code with UWP native implementations (Core library)
- We are using Shared Projects (as Xamarin team recommendation) to be able to be ported in the future to .NET Standard.
- We are thinking in the following solution structure / app architecture:
Project | Namespace | Main Responsibility |
---|---|---|
(Shared Lib) WtsAppCrossPlat.Core | Common code shared among UWP Native and Xamarin | |
Helpers | Common helpers (Observable, RelayCommand?, Singleton…) | |
Strings | Resource shared strings | |
Services | Common shared services (interfaces or abstract classes if required) (i.e. Data Access) | |
Models | Common shared models (base clases or abstract classes if required) | |
ViewModels | Common View Moldes (Some of them would be base classes specialized with specific implementations in other layers) | |
… | ||
(Shared Lib) WtsAppCrossPlat.Shared | Contains code shared by mobile projects (Uwp, iOS and Android). Will handle the app initialization and activation for Xamarin projects | |
ViewModels | Specialized view models shared between Xamarin forms projects | |
Views | Shared views (Xamarin forms based) shared between Xamarin projects | |
Services | Specific service implementations among mobile projects (if required) - in example: Storage implementation based on Xamarin | |
Models | Shared models among Xamarin forms projects (if required) | |
Helpers | Shared helpers among Xamarin forms (if required) | |
… | ||
WtsAppCrossPlat.iOS | Specific implementations for iOS under Xamarin forms | |
ViewModels | Specializations for ViewModels in iOS | |
Views | Specializations for Views in iOS | |
Properties | ||
Services | Specific or concrete implementations of services for iOS (if required) | |
Models | Specific or concrete implementations of services for iOS (if required) | |
Helpers | Specific or concrete implementations of services for iOS (if required) | |
… | ||
WtsAppCrossPlat.Android | Specific implementations for Android under Xamarin forms | |
ViewModels | Specializations for ViewModels in Android | |
Views | Specializations for Views in Android | |
Properties | ||
Services | Specific or concrete implementations of services for Android (if required) | |
Models | Specific or concrete implementations of models for Android (if required) | |
Helpers | Specific or concrete implementations of models for Android (if required) | |
… | ||
WtsAppCrossPlat.UWP | Specific implementations for UWP under Xamarin forms | |
ViewModels | Specializations for ViewModels in UWP | |
Views | Specializations for Views in UWP | |
Services | Specific or concrete implementations of services for Android (if required) | |
Models | Specific or concrete implementations of models for Android (if required) | |
Helpers | Specific or concrete implementations of models for Android (if required) |
We are not going to ship this in v1.5, moving to 2.0 (even we can continue working on it)
Finally, we will not be including the Shared Library for Core parts until we need it.
The Xamarin app architecture we will use can be found here (xamarin-infa branch): https://github.com/Microsoft/WindowsTemplateStudio/tree/xamarin-infra/poc/WtsXamarin