Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nalu-development/nalu
Provides .NET MAUI packages to help with everyday challenges
https://github.com/nalu-development/nalu
maui
Last synced: 2 days ago
JSON representation
Provides .NET MAUI packages to help with everyday challenges
- Host: GitHub
- URL: https://github.com/nalu-development/nalu
- Owner: nalu-development
- License: mit
- Created: 2024-01-17T11:50:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T15:07:39.000Z (7 months ago)
- Last Synced: 2024-05-22T16:30:05.044Z (7 months ago)
- Topics: maui
- Language: C#
- Homepage: https://nalu-development.github.io/nalu/
- Size: 1.06 MB
- Stars: 30
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
- awesome-dotnet-maui - Nalu.Maui.Navigation - based navigation abstraction which handles `IDisposable`, provides navigation guards, and simplifies passing parameters.|[![GitHub stars](https://img.shields.io/github/stars/nalu-development/nalu?style=flat-square)](https://github.com/nalu-development/nalu/stargazers)|[![GitHub last-commit](https://img.shields.io/github/last-commit/nalu-development/nalu?style=flat-square)](https://github.com/nalu-development/nalu/commits) (UI)
README
![Banner](https://raw.githubusercontent.com/nalu-development/nalu/main/Images/Banner.png)
## Nalu [![GitHub Actions Status](https://github.com/nalu-development/nalu/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/nalu-development/nalu/actions/workflows/build.yml)
`Nalu.Maui` provides a set of classes to help you with everyday challenges encountered while working with .NET MAUI.
### Core [![Nalu.Maui.Core NuGet Package](https://img.shields.io/nuget/v/Nalu.Maui.Core.svg)](https://www.nuget.org/packages/Nalu.Maui.Core/) [![Nalu.Maui NuGet Package Downloads](https://img.shields.io/nuget/dt/Nalu.Maui.Core)](https://www.nuget.org/packages/Nalu.Maui.Core/)
The core library is intended to provide a set of common use utilities.
Have you ever noticed that when the user backgrounds the app on iOS, the app is suspended, and the network requests will fail due to `The network connection was lost`?
This is really annoying: it forces us to implement complex retry logic, especially considering that the request may have already hit the server.
To solve this issue, we provide a `NSUrlBackgroundSessionHttpMessageHandler` to be used in your `HttpClient` to allow http request to continue even when the app is in the background.
```csharp
#if IOS
HttpClient client = DeviceInfo.DeviceType == DeviceType.Virtual
? new() // iOS Simulator doesn't support background sessions
: new(new NSUrlBackgroundSessionHttpMessageHandler());
#else
HttpClient client = new();
#endif
```To make this work, you need to change your `AppDelegate` as follows:
```csharp
[Export("application:handleEventsForBackgroundURLSession:completionHandler:")]
public virtual void HandleEventsForBackgroundUrl(UIApplication application, string sessionIdentifier, Action completionHandler)
=> NSUrlBackgroundSessionHttpMessageHandler.HandleEventsForBackgroundUrl(application, sessionIdentifier, completionHandler);
```**Find out more at [Nalu Website](https://nalu-development.github.io/nalu/core.html).**
### Navigation [![Nalu.Maui.Navigation NuGet Package](https://img.shields.io/nuget/v/Nalu.Maui.Navigation.svg)](https://www.nuget.org/packages/Nalu.Maui.Navigation/) [![Nalu.Maui NuGet Package Downloads](https://img.shields.io/nuget/dt/Nalu.Maui.Navigation)](https://www.nuget.org/packages/Nalu.Maui.Navigation/)
The MVVM navigation service offers a straightforward and robust method for navigating between pages and passing parameters.
The navigation system utilizes `Shell` under the hood, allowing you to easily define the flyout menu, tabs, and root pages.
We use a **fluent API** instead of strings to define navigations, supporting both `Relative` and `Absolute` navigation, including navigation guards to prompt the user before leaving a page.
```csharp
// Push the page registered with the DetailPageModel
await _navigationService.GoToAsync(Navigation.Relative().Push());
// Navigate to the `SettingsPageModel` root page
await _navigationService.GoToAsync(Navigation.Absolute().ShellContent());
```Passing parameters is simple and type-safe.
```csharp
// Pop the page and pass a parameter to the previous page model
await _navigationService.GoToAsync(Navigation.Relative().Pop().WithIntent(new MyPopIntent()));
// which should implement `IAppearingAware`
Task OnAppearingAsync(MyPopIntent intent) { ... }
```You can also define navigation guards to prevent navigation from occurring.
```csharp
ValueTask CanLeaveAsync() => { ... ask the user };
```There is an embedded **leak-detector** to help you identify memory leaks in your application.
**Find out more at [Nalu Website](https://nalu-development.github.io/nalu/navigation.html).**
### Layouts [![Nalu.Maui.Layouts NuGet Package](https://img.shields.io/nuget/v/Nalu.Maui.Layouts.svg)](https://www.nuget.org/packages/Nalu.Maui.Layouts/) [![Nalu.Maui NuGet Package Downloads](https://img.shields.io/nuget/dt/Nalu.Maui.Layouts)](https://www.nuget.org/packages/Nalu.Maui.Layouts/)
Cross-platform layouts and utilities for MAUI applications simplify dealing with templates and `BindinginContext` in XAML.
- Have you ever dreamed of having an `if` statement in XAML?
```csharp
```
- Do you want to scope the binding context of a content?
```csharp
```
- And what about rendering a `TemplateSelector` directly like we do on a `CollectionView`?
```csharp
```**Find out more at [Nalu Website](https://nalu-development.github.io/nalu/layouts.html).**