Sands of MAUI: Issue #54
source link: https://www.telerik.com/blogs/sands-of-maui-issue-54
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Sands of MAUI: Issue #54
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 April 25, 2022:
.NET MAUI Release Candidate Overview
No more .NET MAUI Previews—RC status means almost all APIs in the SDK are now locked in. With a 'Go Live' license, developers should have confidence diving into and even shipping cross-platform .NET apps for mobile and desktop.
James talks about how to get started with .NET MAUI RC1 on Windows—grabbing the latest Visual Studio 17.2 Preview 3 with mobile developer workload should pull down everything needed. It was good to see James show things off on MacOS as well—developers should not forget the needed .NET SDK 6.0.300, but Visual Studio 2022 for Mac is out with Preview 9 and .NET MAUI projects kinda work.
James also talked through some of the API changes in .NET MAUI RC1—the Microsoft.Maui.Essentials namespace is no more and has instead been replaced by smaller more granular namespaces for accessing native APIs. It is also good to see the default .NET MAUI project template now throwing in a Styles.xaml file—essentially resource dictionary and a styling guide for much of the built-in UI in .NET MAUI.
And someone is clearly excited to have a PR merged into .NET MAUI base template—yes, the Shell along with navigation is now a part of the default template, getting .NET MAUI developers off to a great start. The migration guide to .NET MAUI RC1 is really helpful—the open source .NET MAUI workshop now runs on latest bits.
Celebrating .NET MAUI RC
It's easy to hear the excitement when the most vocal proponents of .NET MAUI get together to talk about reaching the RC status—yes, it is a big deal after a year long journey through lots of Preview bits for framework/runtime/tooling.
It is wonderful to hear that developers are actually starting to ship apps to the iOS/Android App Stores with .NET MAUI—remember RC1 has a 'Go Live' license in case support is needed. David also talked about some of the behind the scenes efforts—the detailed profiling to squeeze out the last bit of app performance, particularly on Android. It is also quite impressive to see the .NET MAUI team throw in a full style guide in the form of a resource dictionary—without much impact on app startup.
VS tooling is getting polished on both Windows/Mac and project templates are getting fine tuned—it's almost go time for .NET MAUI.
Porting Libraries to .NET MAUI
With .NET MAUI reaching the RC milestone and General Availability (GA) coming up in the horizon, a lot of developers/enterprises may have migration and modernization on their minds. For many, the first step is to port existing apps/libraries to run on modern runtimes—that is, .NET 6 and .NET MAUI.
Luis Matos wrote a wonderful article on porting Xamarin.Forms libraries to run on .NET MAUI, covering strategies and popular tips.
For most apps/libraries today running on Xamarin.Forms, there is some code sharing across platforms—hopefully targeting .NET Standard. Developers need to take a close look at their codebases and make up their minds on how to move things forward—to reuse, rewrite or abandon.
Luis has a good suggestion on how to evaluate each project for compatibility on modern runtimes—and decide whether to Refactor, Rewrite or Bifurcate. If libraries use the .NET Standard, there may be none or little changes needed on existing code to run on .NET 6—there are compatibility checks that would tell developers if any APIs need updates.
The other option is to start a new .NET 6 project and bring over older code through copy/paste—some namespace changes may be needed.
Luis wraps up the post with a list of tips to keep in mind when porting from Xamarin.Forms—.NET 6 multi-targeting and SDK-style projects can help, as can the broader .NET MAUI developer community.
Trying out .NET MAUI
If developers had held off tinkering with .NET MAUI, reaching the RC status might just be the nudge folks needed. Developer extraordinaire Jon Skeet had been keeping an eye out for .NET MAUI and recently took it out for spin—and wrote an honest recap of the developer experience as it stands now.
Jon maintains a Windows desktop app for a church A/V system that would be nice to have on MacOS and even sweeter in the form of a mobile app—a great candidate to try out .NET MAUI on.
Despite having no mobile development experience, Jon was pleasantly surprised by .NET MAUI's productivity—a mobile app was born in a week and polished up for real world use. Tabbed UI is all the rage for mobile apps—and .NET MAUI makes it easy to get started with, thanks to the Shell page now included in default template.
As Jon points out, most developers with any C#/XAML background in WPF/Silverlight/UWP/Xamarin.Forms should feel right at home in .NET MAUI—DataBinding and MVVM concepts are the same. With dependency injection, navigation and native API access built in, .NET MAUI tries to get developers going from a great starting point.
Jon shared a lot of screenshots of the app built with .NET MAUI—they look pretty solid for a developer without design chops.
Sure, it's not all sunshine and Jon pointed out several things .NET MAUI could be better at—like lack of designer support, various bugs, occasional crashes, issues with images/layouts and more. However, as it stands now, if the question is if .NET MAUI functional and has lots of promise—the answer is a resounding yes. Still early days for .NET MAUI and developer validation is nice—the future looks good with continued efforts to make the stack better.
As developers know, most C#/XAML codebases are natural fits for the Model View ViewModel (MVVM) design pattern—and .NET MAUI is no exception. If you are building cross-platform native mobile apps with Xamarin.Forms and open to picking up an MVVM framework, FreshMvvm is here to help.
FreshMvvm is a super light MVVM framework designed specifically for Xamarin.Forms—it is meant to be easy, simple and flexible.
Michael Ridland has been working on a version of FreshMvvm that is compatible with .NET MAUI—appropriately named FreshMvvm.Maui. Developers can begin with the default .NET MAUI project templates and bring in the FreshMvvm.Maui NuGet package—immediate benefits include Navigation, BindingContext wiring up, Page events and more.
Michael pushed out a new version of the FreshMvvm.Maui NuGet package—now compatible with .NET MAUI RC1. It is so nice to see the developer ecosystem building up around .NET MAUI ahead of GA—more ammunition for developers.
That's it for now.
We'll see you next week with more awesome content relevant to .NET MAUI.
Sam Basu is a technologist, author, speaker, Microsoft MVP, gadget-lover and Progress Developer Advocate for Telerik products. With a long developer background, he now spends much of his time advocating modern web/mobile/cloud development platforms on Microsoft/Telerik technology stacks. His spare times call for travel, fast cars, cricket and culinary adventures with the family. You can find him on the internet.
Aggregate valuable and interesting links.
Joyk means Joy of geeK