Sands of MAUI: Concern #85

Welcome to the Sands of MAUI—newsletter-style points devoted to bringing collectively newest .NET MAUI content material related to builders.

A particle of sand—tiny and innocuous. However put loads of sand particles collectively and now we have one thing massive—a drive to reckon with. It’s the smallest grains of sand that usually add as much as type huge seashores, dunes and deserts.

Most .NET builders are excited with .NET Multi-platform App UI (MAUI)—the evolution of recent .NET cross-platform developer expertise. Going
ahead, builders ought to have way more confidence within the expertise stack and instruments as .NET MAUI empowers native cross-platform options on each cell and desktop.

Whereas it could take a protracted flight to achieve the sands of MAUI island, developer pleasure round .NET MAUI is sort of palpable in all of the shared content material. Just like the grains of sand, every bit of reports/article/documentation/video/tutorial/livestream contributes
in direction of developer data in .NET MAUI and we develop a group/ecosystem prepared to be taught & assist.

Sands of MAUI is a humble try to gather all of the .NET MAUI awesomeness in a single place. This is what’s noteworthy for the week of December 19, 2022:

Mix .NET MAUI and Blazor

.NET MAUI and Blazor appear to be a match made in heaven—they share the very same .NET runtime. Armed with a contemporary WebView, .NET MAUI permits for Blazor net parts/types to now work inside native cell/desktop apps. Seems, there are just a few
methods to combine and match .NET MAUI with Blazor—builders can actually share loads of code and get the perfect of each worlds. The Gerald Versluis produced one other great video—3 ways to mix .NET MAUI and Blazor Hybrid inside a single native app.

Gerald begins out explaining Blazor Hybrid and the way the BlazorWebView part wires the whole lot up inside .NET MAUI apps. Builders can mix Blazor and .NET MAUI full pages—there may be nothing stopping a Tabs based mostly navigation sample serving up
net pages, parts or .NET MAUI pages interchangeably.

Whereas Blazor C# code can invoke .NET MAUI platform APIs, builders could typically wish to inject native .NET MAUI pages whereas inside a Blazor Hybrid app with all net content material—that is completely attainable and straightforward. In case a really native app expertise
is desired whereas utilizing Blazor Hybrid mode, Gerald showcases scanning Barcodes performance by pulling up .NET MAUI Popup from Blazor code.

Blazor and .NET MAUI mixed is a superb playground—.NET builders can combine and match and cater the specified UI/UX whereas sharing code.

Blazor throughout Internet and Native

Blazor is understandably probably the most thrilling net framework for .NET builders, permitting C# to run server-side or fully client-side via WebAssembly. And .NET MAUI ushers within the subsequent era of native cross-platform improvement on .NET, effortlessly
reaching cell/desktop platforms from a single codebase. With a contemporary WebView UI part, .NET MAUI welcomes Blazor to place of origin—net parts and types might be rendered inside native apps on iOS/Android/Home windows/Mac.

Although Blazor is powering UI/UX throughout net and native apps, there could also be variations to how issues work throughout platforms. Whereas Blazor parts/types can render the identical UI throughout net, desktop and cell, the UX shouldn’t be the identical. In
truth, builders will wish to have the flexibleness to do various things with Blazor throughout varied platforms. Generic interfaces with platform-specific implementations can enable builders to have constant shared code that occurs to work
in another way throughout net and cell/desktop platforms.

A struggling developer wrote up an article on sharing code between .NET MAUI and Blazor—but having various implementations of Blazor code throughout net and native platforms.

.NET MAUI Launch

.NET MAUI for .NET 7 was a milestone launch, bringing runtime maturity to the .NET MAUI framework and steady tooling throughout Home windows/macOS. Change is the one factor that is everlasting, so the .NET MAUI engineering work strikes onwards for what’s subsequent.

David Ortinau identified a brand new launch—.NET MAUI 7.0.52 Service Launch 1.1 is now out.

What’s new within the newest .NET MAUI service launch? The .NET MAUI launch bits are suitable with Visible Studio 17.4.3 on macOS and Home windows, including to improved platform stability. Seems to be like updating to the newest in Apple/iOS/macOS ecosystem
is massive on the agenda—there may be now assist for Xcode 14.1 for iOS, iPadOS and Mac Catalyst model 16.1. Different platforms are usually not be left behind, both—there may be freshly added assist for Android API 33 and Home windows App SDK 1.2.221109.1.

A sort converter change has additionally vastly improved the variety of XAML Scorching Reload successes—issues look to be settled for Mac Catalyst. There may be new API documentation and plenty of fastened points—onwards and upwards.

Pointer Gestures in .NET MAUI

.NET MAUI is the subsequent era of .NET cross-platform technique throughout cell and desktop—this implies contact and mouse have equal footing. Most pill/desktop app customers would work together with .NET MAUI apps with mouse/keyboard and .NET MAUI
tries to assist builders out with the brand new Pointer Gesture Recognizers.

Leomaris Reyes is right here to coach fellow builders and wrote up a pleasant article about all issues Pointer Gesture Recognizer in .NET MAUI.

The brand new Pointer recognizers in .NET MAUI enable builders to trace consumer actions so as to add interactions, make selections, change Visible States and replace total UX. Given an assigned a part of the visible tree, Pointer Gesture Recognizer permits for
detection of pointer actions—for Entry, Motion and Exit akin to the bounding space. The PointerGestureRecognizer class does all of the heavy lifting and exposes corresponding Occasions/Instructions.

Leomaris drives the purpose dwelling with easy-to-follow code examples, and factors out that Pointer gesture recognition, as anticipated, is supported solely on iPadOS, Mac Catalyst and Home windows.

Audio Streaming in .NET MAUI

For the reason that early previews of .NET MAUI, builders have puzzled the best way to play media recordsdata similar to video or MP3 and the best way to stream from an endpoint. With built-in media playback, issues get difficult shortly throughout platforms—there are
particular settings for iOS/Android and background streaming takes further work. Fortunately, Gerald Versluis and crew are placing in strong work for the MediaElement within the .NET MAUI Group Toolkit and Christian Jacob wrote up a pleasant article as part of the .NET MAUI Introduction Calendar—Background audio streaming with CommunityToolkit.Maui.MediaElement.

Christian begins out breaking down the complexities of the sport, with particulars about ExoPlayer for Android and AVPlayer for iOS. The MediaElement may be very promising, however in Preview as an lively Pull Request on the .NET MAUI Group Toolkit
GitHub repository.

Chrstian walks via how .NET MAUI builders can seize the preview MediaElement NuGet bundle for his or her tasks and use the extension technique to register all crucial Handlers. With the preliminary setup, one can theoretically initialize
and begin utilizing the MediaElement in .NET MAUI pages for fundamental use circumstances. Nevertheless, Christian shortly factors out the extra setup wanted for extra advanced situations—safety settings required in Android to stream from HTTP endpoints
and enabling background streaming on iOS via app lifecycle hooks.

There are many complexities and platform-specific nuances to background media playback on iOS/Android/Home windows—cheers, Christian, for writing up the main points.

That is it for now.

We’ll take a two-week break for the vacations, and see you again right here January 9 with extra superior content material related to .NET MAUI. Joyful Holidays!

Cheers, builders!

Telerik UI for .NET MAUI: Kickstart your multiplatform application development

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles