MvvmCrud helps your Xamarin.Forms/MAUI app with Prism Library to standardize operations of creating, updating, deletion and display data, from REST API.
Preview | Stable | |
---|---|---|
Xamarin.Forms_5 | ||
MAUI_NET7 |
mvvmcrud.mp4
This framework standardize CRUD's operations into ViewModel's file using generic T type, endpoint's requests and fully customizable.
The target is WRITE LESS CODE, STANDARDIZING THE MOST USED UI CRUD OPERATIONS, IMPROVE PRODUCTIVITY SPEED.
Only with these following lines of code your page can:
- Display list of data
- Embedded custom message, if endpoint fails
- Embedded pagination's manager
- Embedded Perform searchs
- Embedded deletion cell's content, with automatic detect endpoint and confirm message
- Embedded update cell's content, with automatic: detect endpoint, open page, save, upload and update list's cell
- Embedded open detail's page
- Embedded empty view UI
- Embedded loadig more view UI
All fully customizable!
namespace MVVMCrud.Example.ViewModels.Post
{
public class PostPageViewModel : BaseListPaginationAdvancedViewModel
<PostCellViewModel, BaseModelItemsRoot<PostItem>, PostItem>
{
public PostPageViewModel(
INavigationService navigationService,
IRequestService requestService) : base(navigationService, requestService)
{
}
public override string SetupEndpoint() => Constants.Constants.METHOD_POST;
public override async void AddNewItem(PostItem item)
{
SetupAddItemMessage();
await SetupGetItems();
}
public override async void UpdateEditItem(NewEditItem<PostItem> newEditItem)
{
SetupEditItemMessage();
await SetupGetItems();
}
public override List<PostCellViewModel> PerformSearchSetup(string newText) => ItemsList.Where(x => x.Item.Title.Contains(newText.ToLower())).ToList();
#region DetailPage
public override string SetupDetailPageName(PostCellViewModel obj) => nameof(CommentPage);
public override bool IsDetailPageWithHeader(PostCellViewModel obj) => true;
#endregion
}
}
- Clone this repository and check app's example. App's example use the follow endpoint https://jsonplaceholder.typicode.com/ to test functionality.
- Go to Wiki page. (Under construction)
Use GitHub Issues for bug reports and feature requests.
Use GitHub Discussios for questions or opinions.
This is at the moment an experiment. Use at your own risk.
Code released under the MIT license.