How To Write Platform-Specific Code in .NET MAUI

Share
Gerald Versluis
Published at : 17 Dec 2021
1400 views
133

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:
https://www.youtube.com/channel/GeraldVersluis/join

🛑 Don’t forget to subscribe to my channel for more cool content: https://www.youtube.com/GeraldVersluis/?sub_confirmation=1

🐦 Follow me on Twitter: https://twitter.com/jfversluis
🤝 Join the Discord server: https://discord.gg/2cAyTGNHBD

🔗 Links
Sample code repo: https://github.com/jfversluis/MauiPlatformCodeSample
Windows Subsystem for Android Video: https://www.youtube.com/watch?v=r3NwzDmmRdY

⏱ 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?

🎥 Video edited with Camtasia (ref): https://techsmith.z6rjha.net/AJoeD

🙋‍♂️ Also find my…
Blog: https://blog.verslu.is
Twitch: https://twitch.tv/jfversluis
All the rest: https://jfversluis.dev

#dotnetmaui #platformspecific #maui #dotnet6 #multitargeting #singleproject

.net mauidotnet maui.net maui example

Yo Gotti - Rake It Up ft. Nicki Minaj

Yo Gotti - Rake It Up ft. Nicki Minaj

Pulled My Teenage Sons Bed Away From The Wall And Found This #Shorts

Pulled My Teenage Sons Bed Away From The Wall And Found This #Shorts

Iraq:several killed as a result of floods caused by heavy rains in Iraqs Erbil

Iraq:several killed as a result of floods caused by heavy rains in Iraqs Erbil

Such An Awesome God (LIVE) - FWC Singers Joseph Larson and Grace Brumley

Such An Awesome God (LIVE) - FWC Singers Joseph Larson and Grace Brumley

A Look At Putin's $125 Million Dollar Yacht Collection

A Look At Putin's $125 Million Dollar Yacht Collection

UML Class Diagrams - Association and Multiplicity

UML Class Diagrams - Association and Multiplicity

PART 1: How do we keep persevering? With James & Olivia Shone

PART 1: How do we keep persevering? With James & Olivia Shone

Judy Murray & Anton du Beke Charleston to ‘Varsity Drag’ - Strictly Come Dancing: 2014 - BBC One

Judy Murray & Anton du Beke Charleston to ‘Varsity Drag’ - Strictly Come Dancing: 2014 - BBC One

K3, een nieuw begin Aflevering 1

K3, een nieuw begin Aflevering 1

Legeona - '97 Ft. Dj ALX [Official Video]

Legeona - '97 Ft. Dj ALX [Official Video]

The FINAL BOSS in Fortnite!

The FINAL BOSS in Fortnite!

jazz/lofi hip hop radio🌱chill beats to relax/study to [LIVE 24/7]

jazz/lofi hip hop radio🌱chill beats to relax/study to [LIVE 24/7]

How to Fix A Running Toilet GUARANTEED | DIY Plumbing Repair

How to Fix A Running Toilet GUARANTEED | DIY Plumbing Repair

Out in the Streets

Out in the Streets

Big Brother | Νίκος και Ευδοκία σηκώνουν την κούπα σε πελάγη ευτυχίας! | 17/12/2021

Big Brother | Νίκος και Ευδοκία σηκώνουν την κούπα σε πελάγη ευτυχίας! | 17/12/2021

🎁 Kids Book Read Aloud: IT'S NOT EASY BEING SANTA by Pragya Tomar, Ramona Mclean, and Michela Fiori

🎁 Kids Book Read Aloud: IT'S NOT EASY BEING SANTA by Pragya Tomar, Ramona Mclean, and Michela Fiori

KALLY'S Mashup Cast, Alex Hoyer - Crushed (Official Video) ft. Alex Hoyer

KALLY'S Mashup Cast, Alex Hoyer - Crushed (Official Video) ft. Alex Hoyer

Hard Falling Wins Vs. Fails & More! | People Are Awesome Vs. FailArmy

Hard Falling Wins Vs. Fails & More! | People Are Awesome Vs. FailArmy

الخضر وسبايدرمان الملون Be sure to watch the new 2021 Comedy Video

الخضر وسبايدرمان الملون Be sure to watch the new 2021 Comedy Video

JUICED UP Sykkuno SHOWS NO MERCY as the GOD GAMER battling with Ludwig | Super Auto Pets (SAP)

JUICED UP Sykkuno SHOWS NO MERCY as the GOD GAMER battling with Ludwig | Super Auto Pets (SAP)

Haunted Books, Fired cop Prank and MORE! | Just for Laughs Compilation

Haunted Books, Fired cop Prank and MORE! | Just for Laughs Compilation

Abraham Hicks. I am in a process of looking for a job

Abraham Hicks. I am in a process of looking for a job

Healing From My Old Wounds -  Muthoni Gitau

Healing From My Old Wounds - Muthoni Gitau

Οι ΗΠΑ 💪"θωρακίζουν" την γεώτρηση της ExxonMobil στην κυπριακή ΑΟΖ

Οι ΗΠΑ 💪"θωρακίζουν" την γεώτρηση της ExxonMobil στην κυπριακή ΑΟΖ

How to encourage and engage students to participate in and utilize offerings from BUV?

How to encourage and engage students to participate in and utilize offerings from BUV?

President Biden on the Importance of Bipartisanship & Vaccines, Rejecting Extremism in Trump’s GOP

President Biden on the Importance of Bipartisanship & Vaccines, Rejecting Extremism in Trump’s GOP

Scoring a 99 Yard Touchdown with EVERY NFL Running Back in ONE VIDEO!

Scoring a 99 Yard Touchdown with EVERY NFL Running Back in ONE VIDEO!

Developing an Effective Route to Market - Chidi Okoro

Developing an Effective Route to Market - Chidi Okoro

7 of the Best New Fallout 4 Mods You Will Want to Download (Tactical Mods)

7 of the Best New Fallout 4 Mods You Will Want to Download (Tactical Mods)

CHASTEN YOUR CHILDREN EARLY AND OCCASIONALLY.

CHASTEN YOUR CHILDREN EARLY AND OCCASIONALLY.

Dad Reacts to Tyler, the Creator - IGOR

Dad Reacts to Tyler, the Creator - IGOR

Object vehicles

Object vehicles

Be Good Over a Long Period of Time

Be Good Over a Long Period of Time

Open All The Cupboards

Open All The Cupboards

Grubby | WC3 | How To Beat PALA RIFLE As Orc!

Grubby | WC3 | How To Beat PALA RIFLE As Orc!

Witxes LIVE - A fabric of beliefs -

Witxes LIVE - A fabric of beliefs -

Out of Control Big Rig Trucks Are Causing Horrible Accidents

Out of Control Big Rig Trucks Are Causing Horrible Accidents

Buying EVERYTHING My SON Touches... **CHALLENGE**

Buying EVERYTHING My SON Touches... **CHALLENGE**

THE DESIRE TO LIVE: Patara, Artsakh (Armenian with English subtitles) DOCUMENTARY S2E8

THE DESIRE TO LIVE: Patara, Artsakh (Armenian with English subtitles) DOCUMENTARY S2E8

IROS 2019: A Robust Laser-Inertial Odometry and Mapping Method for Large-Scale Highway Environments

IROS 2019: A Robust Laser-Inertial Odometry and Mapping Method for Large-Scale Highway Environments

It Sounds Impossible...A GIGANTIC Object Is Hoovering Up Saturn's Rings

It Sounds Impossible...A GIGANTIC Object Is Hoovering Up Saturn's Rings

Same type of stand as Star Platinum | JoJo's Bizarre Memes V97

Same type of stand as Star Platinum | JoJo's Bizarre Memes V97

Why Prince Remigius Fell In Love With A Commoner | Undercover Princes | Real Royalty

Why Prince Remigius Fell In Love With A Commoner | Undercover Princes | Real Royalty

Alternative facts

Alternative facts

5 Mistakes Average Players Make In Matches

5 Mistakes Average Players Make In Matches

MyPillow Mike’s 96 Hour Delusia-Palooza, Trump Gets Naked & the 200 Craziest People in America

MyPillow Mike’s 96 Hour Delusia-Palooza, Trump Gets Naked & the 200 Craziest People in America

Minecraft Manhunt, But There's A Super Imposter...

Minecraft Manhunt, But There's A Super Imposter...

Farmer Nappy - My House (Official Music Video) "2015 Soca" [HD]

Farmer Nappy - My House (Official Music Video) "2015 Soca" [HD]

How To Get Infinite Money with No Mods in Cities Skylines!

How To Get Infinite Money with No Mods in Cities Skylines!