How To Write Platform-Specific Code in .NET MAUI

preview_player
Показать описание
At some point you will find yourself needing to write some platform code while using .NET MAUI. Luckily, this is very much possible! In this video we will see how to leverage the multi-targeting approach in .NET MAUI single project to write platform-specific code.

💝 Join this channel to get access to perks:

🔗 Links

⏱ Timestamps
00:00 - Intro: Platform Code in .NET MAUI
00:15 - Amazing Members Shoutout!
01:11 - Understanding Platform Code in .NET MAUI
03:14 - Create Partial Class in Shared Code
05:58 - Implement Platform Specific Android Code
07:58 - Implement Platform Specific iOS Code
10:48 - Outro: Other Ways To Do This?

🙋‍♂️ Also find my...

#dotnetmaui #platformspecific #maui #dotnet6 #multitargeting #singleproject
Рекомендации по теме
Комментарии
Автор

This video is so satisfying... I find "Patternization" of concepts such as this to be extremely insightful! Thank you for this video, keep it up!

NbWfer
Автор

Love the video, but I do wish it started more generally:
1. At a high level: How many ways are there to write platform specific code in Maui? If/else, partial classes, shared interfaces, etc?
2. When should I reach for compiler directives, partial classes, partial methods, shared interfaces or dependency injection? What are the use cases, advantages of each?
3. Would love to see an example of each!
Thanks again - extremely helpful!

FEAT
Автор

During this video I was thinking that I would prefer doing it with dependency injection and having a shared Interface. Looks like I predicted your next video :D When is it going to be available?

larablokker
Автор

Красавец, большое тебе спасибо, ты лучший!))

xdpalad
Автор

Hello Gerald, could you make a video about splash screen with dark and light mode on each plataform please? :)

welissonarley
Автор

Hello Gerald. How does your example work in a .NET MAUI Class Library project?

muchbeda
Автор

Is it possible to access the underlying Android API, so you can access features for which .NET did not build an abstraction? I want to use the Picture-in-Picture mode in Android, but I don't think you can do that yet with the .NET Maui interface. Would it be possible to use the Picture-in-Picture mode in a .NET Maui project written in Java?

didac
Автор

VS2022 17.2 Preview 1 doesn't seem to like UIKit. Is that no longer needed or in something else now?

dowerchin
Автор

Hello, Dependency injection not work for me, for some reason MAUI no detects the folder Platforms. But this method works. Thx,

turelzahlane
Автор

Gerald, can u teach how to show and hide a password in a xamarin forms app?

thiagotakatsu
Автор

Hello I tried the Same and this is giving me an error that Partial method doesnt Contain Multiple Implementation.

sanjanapatel
Автор

How do I publish to windows.. I can run the application on debug but when i try to publish i get an error.. I wanted to create an installer

ThimaKulani
Автор

How does one write methods with platform-specific return types?

zxph
Автор

How would you add a platform specific nuget package?

jeffsiemens
Автор

Hello Gerald, do you know if there is any documentation on how to set the XAML according to platform ? I didn't find anything. I'm looking for somthing like "MyPage.android.xaml / MyPage.ios.xaml" because if you have a really different UI for each platform, it's not possible to rely on On<Android> everytime and everywhere otherwise it becomes unreadable and unmaintainable. Thanks!

Nkfr
visit shbcf.ru