SweetMeSoft.Mobile.Base
1.11.129
dotnet add package SweetMeSoft.Mobile.Base --version 1.11.129
NuGet\Install-Package SweetMeSoft.Mobile.Base -Version 1.11.129
<PackageReference Include="SweetMeSoft.Mobile.Base" Version="1.11.129" />
<PackageVersion Include="SweetMeSoft.Mobile.Base" Version="1.11.129" />
<PackageReference Include="SweetMeSoft.Mobile.Base" />
paket add SweetMeSoft.Mobile.Base --version 1.11.129
#r "nuget: SweetMeSoft.Mobile.Base, 1.11.129"
#:package SweetMeSoft.Mobile.Base@1.11.129
#addin nuget:?package=SweetMeSoft.Mobile.Base&version=1.11.129
#tool nuget:?package=SweetMeSoft.Mobile.Base&version=1.11.129
SweetMeSoft.Mobile.Base
Base library with a set of utilities, base classes and services to accelerate .NET MAUI application development.
Description
SweetMeSoft.Mobile.Base
is a library for .NET MAUI that provides a robust base architecture for mobile applications, following the MVVM pattern. It includes a base ViewModel with integrated functionalities, a popup service, and extensions for simple initial configuration.
Features
- Simple Configuration (
AppHostBuilderExtensions
):- An extension method
UseSweetMeSoftBase
forMauiAppBuilder
that initializes necessary dependencies likeCommunityToolkit.Maui
andUserDialogs
.
- An extension method
- Base ViewModel (
AppBaseViewModel
):- Navigation: Inherits from
NavigationViewModel
(not included but implicit) for simple navigation management. - API Wrapper:
Get
andPost
methods that integrate withSweetMeSoft.Connectivity
to perform HTTP requests. They automatically manage connectivity, authentication tokens and loading indicators. - Dialogs and Popups: Integrates with
Acr.UserDialogs
for alerts and confirmations, and uses its ownPopupsService
to show a "loading" popup. - Permission Management: Helpers to verify and request device permissions using MAUI APIs.
- Hardware Access: Functions to get GPS location.
- Session Management: A
Logout
method to clear user preferences and restart navigation.
- Navigation: Inherits from
- Popup Service (
PopupsService
):- A singleton service to show and hide a loading popup (
LoadingPopup
) consistently throughout the application.
- A singleton service to show and hide a loading popup (
Dependencies
Installation
dotnet add package SweetMeSoft.Mobile.Base
Usage
1. Configuration in MauiProgram.cs
In your MauiProgram.cs
file, use the UseSweetMeSoftBase
method to register the library and its dependencies.
using SweetMeSoft.Mobile.Base;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
// Call the extension method and pass your API base URL
.UseSweetMeSoftBase("https://api.yourdomain.com")
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
// ... Register your own views and viewmodels
// builder.Services.AddSingleton<MyPage>();
// builder.Services.AddSingleton<MyViewModel>();
return builder.Build();
}
}
2. Inherit from AppBaseViewModel
Create your ViewModels inheriting from AppBaseViewModel
to access all the integrated functionality.
using SweetMeSoft.Mobile.Base.ViewModels;
using CommunityToolkit.Mvvm.Input; // Required for [RelayCommand]
using System.Threading.Tasks;
public partial class MyViewModel : AppBaseViewModel
{
// Observable properties can be defined with CommunityToolkit.Mvvm
// [ObservableProperty]
// private string myData;
public MyViewModel()
{
// AppBaseViewModel handles navigation through Shell or NavigationPage
}
[RelayCommand]
private async Task LoadDataAsync()
{
// The 'true' in showLoading is the default value, which
// will automatically activate PopupsService.ShowLoading/HideLoading.
var result = await Get<MyDataModel>("/my-api/endpoint", showLoading: true);
if (result != null)
{
// ... process the result
// MyData = result.SomeProperty;
}
}
[RelayCommand]
private async Task GoToDetailsAsync()
{
// Navigate to another page registered in the DI Container
await GoToAsync<DetailsPage>();
}
}
3. Usage in View (XAML)
Bind your ViewModel commands to your view controls.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:MyProject.ViewModels"
x:Class="MyProject.MyPage"
x:DataType="vm:MyViewModel">
<VerticalStackLayout>
<Button Text="Load Data" Command="{Binding LoadDataCommand}" />
<Button Text="View Details" Command="{Binding GoToDetailsCommand}" />
</VerticalStackLayout>
</ContentPage>
License
This project is under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0-android35.0 is compatible. net9.0-ios18.0 is compatible. net9.0-maccatalyst18.0 is compatible. net9.0-windows10.0.19041 is compatible. net10.0-android was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-windows was computed. |
-
net9.0-android35.0
- Acr.UserDialogs (>= 9.2.2)
- CommunityToolkit.Maui (>= 11.2.0)
- CommunityToolkit.Maui.Core (>= 11.2.0)
- CommunityToolkit.Mvvm (>= 8.4.0)
- Controls.UserDialogs.Maui (>= 1.7.0)
- Microsoft.Maui.Controls (>= 9.0.110)
- Microsoft.Maui.Controls.Compatibility (>= 9.0.110)
- SweetMeSoft.Connectivity (>= 1.10.129)
-
net9.0-ios18.0
- Acr.UserDialogs (>= 9.2.2)
- CommunityToolkit.Maui (>= 11.2.0)
- CommunityToolkit.Maui.Core (>= 11.2.0)
- CommunityToolkit.Mvvm (>= 8.4.0)
- Controls.UserDialogs.Maui (>= 1.7.0)
- Microsoft.Maui.Controls (>= 9.0.110)
- Microsoft.Maui.Controls.Compatibility (>= 9.0.110)
- SweetMeSoft.Connectivity (>= 1.10.129)
-
net9.0-maccatalyst18.0
- Acr.UserDialogs (>= 9.2.2)
- CommunityToolkit.Maui (>= 11.2.0)
- CommunityToolkit.Maui.Core (>= 11.2.0)
- CommunityToolkit.Mvvm (>= 8.4.0)
- Controls.UserDialogs.Maui (>= 1.7.0)
- Microsoft.Maui.Controls (>= 9.0.110)
- Microsoft.Maui.Controls.Compatibility (>= 9.0.110)
- SweetMeSoft.Connectivity (>= 1.10.129)
-
net9.0-windows10.0.19041
- Acr.UserDialogs (>= 9.2.2)
- CommunityToolkit.Maui (>= 11.2.0)
- CommunityToolkit.Maui.Core (>= 11.2.0)
- CommunityToolkit.Mvvm (>= 8.4.0)
- Controls.UserDialogs.Maui (>= 1.7.0)
- Microsoft.Maui.Controls (>= 9.0.110)
- Microsoft.Maui.Controls.Compatibility (>= 9.0.110)
- SweetMeSoft.Connectivity (>= 1.10.129)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.11.129 | 281 | 9/17/2025 |
1.11.128 | 194 | 4/19/2025 |
1.11.127 | 207 | 4/19/2025 |
1.11.126 | 205 | 4/19/2025 |
1.11.125 | 125 | 4/19/2025 |
1.11.124 | 121 | 4/19/2025 |
1.11.123 | 189 | 4/4/2025 |
1.11.122 | 180 | 7/23/2024 |
1.11.121 | 168 | 6/26/2024 |
1.11.120 | 154 | 6/24/2024 |
1.11.119 | 165 | 6/21/2024 |
1.11.118 | 164 | 6/21/2024 |
1.11.117 | 153 | 5/31/2024 |
1.11.116 | 160 | 5/31/2024 |
1.11.115 | 169 | 4/14/2024 |
1.11.114 | 181 | 4/13/2024 |
1.11.112 | 168 | 4/3/2024 |
1.11.111 | 151 | 4/2/2024 |
1.11.110 | 165 | 3/16/2024 |
1.11.109 | 164 | 3/4/2024 |
1.11.108 | 171 | 3/3/2024 |
1.11.107 | 188 | 3/2/2024 |
1.11.106 | 165 | 2/23/2024 |
1.11.105 | 163 | 2/19/2024 |
1.11.104 | 163 | 2/16/2024 |
1.11.103 | 163 | 2/15/2024 |
1.11.102 | 184 | 2/12/2024 |
1.11.101 | 166 | 2/12/2024 |