Sands of MAUI: Issue #46

0
45
Sands of MAUI: Issue #37


Welcome to the Sands of MAUI—newsletter-style issues dedicated to bringing together latest .NET MAUI content relevant to developers.

A particle of sand—tiny and innocuous. But put a lot of sand particles together and we have something big—a force to reckon with. It is the smallest grains of sand that often add up to form massive beaches, dunes and deserts.

Most .NET developers are looking forward to .NET Multi-platform App UI (MAUI)—the evolution of Xamarin.Forms with .NET 6. Going forward, developers should have much more confidence in the technology stack and tools as .NET MAUI empowers native cross-platform solutions on mobile and desktop.

While it is a long flight until we reach the sands of MAUI, developer excitement is palpable in all the news/content as we tinker and prepare for .NET MAUI. Like the grains of sand, every piece of news/article/video/tutorial/stream contributes towards developer knowledge and we grow a community/ecosystem willing to learn and help.

Sands of MAUI is a humble attempt to collect all the .NET MAUI awesomeness in one place. Here’s what is noteworthy for the week of February 28, 2022:

.NET MAUI Overview

There was a lot of .NET love shared during .NET Frontend Day and Gerald Versluis opened the show with a wonderful overview of .NET MAUI. Gerald started with why .NET MAUI is the evolution of Xamarin.Forms—what the production reality looks like today and how things are changing for the better in .NET MAUI.

The discussion started with the basics of how .NET MAUI works—the runtime, built-in controls, layouts and accessibility. Gerald then went on to talk about Drawn UI with Maui.Graphics.Controls library, Single Project experience, Hot Reload for developer productivity, .NET MAUI Essentials, Blazor Hybrid and more—and demonstrated all the things with on-point demos.

If you are on the fence about .NET MAUI or just starting to tinker, this is a wonderful place to start—the Q/A at the end had honest conversations about where .NET MAUI differentiates itself from the competition.

MauiOverview

.NET MAUI Preview 13 Details

There is a lot of engineering work being done on .NET MAUI—Preview 13 has been out and Release Candidate (RC) bits are getting closer. James Montemagno produced a video covering all things new in .NET MAUI Preview 13—this is a great resource to catch up on all the latest framework/tooling enhancements.

James starts up talking about how .NET MAUI apps are bootstrapped in MauiProgram.cs—the .NET generic host builder makes it easy to configure a variety of services/dependencies at startup. Hard not to mention the ease of configuring .NET MAUI Essentials for native API access and exposing platform-specific life cycle events through #if-endif compiler directives.

James then moves to to talk about updates to Dependency Injection in .NET MAUI—many core services for each of the platforms are now pre-wired, making developers write less boilerplate code. The excitement is palpable as .NET MAUI features get solidified, tooling improved and releases get overall more stable—all signs of eventual readiness for General Availability (GA).

Maui13Overview

Migration/Modernization with .NET MAUI

.NET 6 carries the Long Term Support (LTS) badge and it is making a lot of enterprises consider migrating apps to run on .NET 6. .NET MAUI and Blazor are also helping when folks consider modernizing their application stacks—’legacy’ apps can run on latest .NET runtimes and developers can bring in small islands of modern UI.

A curious developer spoke at .NET Frontend Day on app modernization with .NET MAUI—drawing from experiences of talking to many customers on the modernization journey.

Started on Xamarin.Forms and now want to move to .NET MAUI? That should be an easy transition with understanding of project differences, namespace changes and Renderer vs Handler architecture—tooling will help as well. Got WinForms/WPF apps running on .NET Framework? Well, the .NET Upgrade Assistant can attempt to migrate the project/runtime to .NET 6 and BlazorWebView can bring in Blazor UI for modern islands within the app.

If running Web API with .NET, migration to .NET 6 will earn performance benefits or starting afresh with Minimal APIs lowers the barrier to entry. Got investments in JavaScript—making modern web apps with frameworks like Angular/React/Vue? All that is also welcome in mobile/desktop apps with .NET MAUI. While BlazorWebView does not care, the Blazor story is obviously better with shared runtime rather than JS Interop for web code to talk to .NET. Bottomline, developers have choices as they plot migration/modernization with .NET 6 and .NET MAUI.

MauiMigration

.NET MAUI Development on Mac

The current state of affairs with .NET MAUI tooling/documentation definitely favors Windows as a development platform—sure Visual Studio 2022 Previews offer the best developer experience. However, much of .NET MAUI tooling started with Command Line tools and the CLI tools work cross-platform. Some developers still prefer tinkering with .NET MAUI on MacOS—after all, you can run iOS and MacCatalyst apps natively.

Daniel Hindrikes posted a video of doing .NET MAUI development on MacOS. Turns out, if developers embrace CLI tools, the experience on MacOS isn’t bad—VS Code allows working with .NET MAUI projects with a command line prompt built right in.

If developers turn off the .NET MAUI multi-targeted builds and focus on just one platform like MacCatalyst, the latest Preview versions of VS 2022 for Mac also support debugging. You can catch another developer doing .NET MAUI development exclusively on MacOS for the .NET Dev Show streams—if Apple hardware ecosystem is where you belong, .NET MAUI works just fine and the tooling will just get better.

MauiOnMac

.NET MAUI Templates

Want to start off on a good note building .NET MAUI apps? Vijay Anand has you covered with a consolidated .NET MAUI app project template. The unified .NET MAUI app project template is published as both a VS Extension and CLI template package—developers on both Windows and MacOS are welcome. If using command line, grab the templates through dotnet new—install VijayAnand.MauiTemplates and fire up a new .NET MAUI app as dotnet new mauiapp—plenty of options to customize the project creation through CLI tool. The same project templates are also accessible within Visual Studio IDE—just grab the extension.

Developers can create .NET MAUI apps or shared libraries—both have the option to include references for the officially supported .NET MAUI CommunityToolkit and Markup packages.

Also included in the template options are several common app design patterns—like Plain, Hierarchical, Tab, Shell and Hybrid. Want all possible options along with available tooling to kickstart your .NET MAUI app? The all-in-one template has it all to get developers going.

MauiTemplates

That’s it for now.

We’ll see you next week with more awesome content relevant to .NET MAUI.

Cheers, developers!





Source link

Leave a reply

Please enter your comment!
Please enter your name here