.NET MAUI Preview 6: SDK Workload Installation, Gestures, Clipping, Alerts, More
.NET MAUI has been improved in many ways in this week's release of .NET 6 Preview 6 as the evolution of Xamarin.Forms (NET Multi-platform App UI), which adds desktop support to the traditional iOS and Android mobile development, takes shape.
.NET 6 Preview 6 shipped July 14, featuring better Live Preview and Hot Reload functionality, along with many other improvements.
For .NET MAUI, soon to subsume Xamarin.Forms as Microsoft's go-to mobile dev option, one major change in Preview 6 is that it now works with Microsoft's new concept of SDK workloads to enable specific development scenarios on top of the main .NET SDK.
The SDK workloads scheme will replace the old monolithic SDK approach, which was burdened by a long build times and large distribution sizes.
"Instead, all new workloads will be built and delivered separately from the SDK, and will be acquirable via your favorite installation tool (like the Visual Studio Installer, a Linux package manager, or the .NET CLI)," Microsoft said last month in announcing .NET 6 Preview 5. "In the fullness of time, we intend for all .NET workloads to follow this pattern, resulting in a very small and focused SDK."
Partially into the fullness of time, .NET MAUI workloads now follow this pattern. David Ortinau, principal program manager, .NET Multi-platform App UI, recently discussed the change in what was called the Final Xamarin Podcast. Ortinau discussed the new SDK loading experience, which he called a "network load," using the new
dotnet network install command. It's backed by NuGet, which is used by Microsoft to install Android, iOS, macOS, .NET MAUI, Blazor and other tooling. "So with the dotnet installer, you can actually install optional workloads, of which MAUI is now one," said Ortinau. "So if you are a command-line junkie and you really, really enjoy getting getting your fingers dirty with keystrokes, then this is for you. So you can do a network load install command and pass MAUI as the workload ID and it will go out and grab all the SDKs that you need to be able to run a MAUI application."
He explained more in this week's announcement: "In preview 4 the underlying SDKs for Android, iOS, macOS, and Mac Catalyst were enabled, and now in preview 6 we are introducing the
maui-desktop workloads. The first will acquire and install all the required SDKs for building .NET MAUI applications. If you are only wanting to target mobile or desktop, you can choose those individually. In the near future Visual Studio 2022 will include these with its installer. To use them today, jump into your favorite CLI."
Speaking of Visual Studio 2022 -- which also shipped this week in Preview 2 -- Ortinau said "This release we are all-in on Visual Studio 2022 Preview 2." Developers can use the latest IDE preview to try out new .NET MAUI capabilities including:
Gestures: With gesture recognizers developers can apply tap, pinch, pan, swipe, and drag-and-drop to any view instance, easily applied in XAML.
- Clipping: To mask content, coders can now add shapes to the clipping region of a layout or view, which is most often done to make a circle image or, as shown below, a crescent moon:
- Native Alerts: "Each platform has a native way of displaying alerts to users. These can be simple informational popups, simple input forms, and even action sheets with multiple options to guide a user. These are available from any Page in a .NET MAUI application."
Single Project and Windows: Based on developer feedback, Microsoft made several updates to single project scenarios. Changes that will require updates in existing solutions include:
- The NuGet package is replaced with the .NET MAUI workload (
<UseMaui>true</UseMaui> in the .csproj).
- Single project solutions now nest individual platforms within a "Platforms" folder for tidy organization.
- Updated to Windows App SDK 0.8.1 RC. Use the latest Visual Studio 2022 compatible extensions from the marketplace.
While the above provides a snapshot of Preview 6, the .NET MAUI roadmap shows what's coming up next month in Preview 7:
- App Lifecycle Events
- Application Properties
- MenuItem (Desktop)
- Native Embedding (Context factory)
For more information, readers can consult documentation, the GitHub repo and the status report, which shows how far various features are progressing to completion.
David Ramel is an editor and writer for Converge360.