Answer
OnPlatform supplies different values per platform (iOS/Android/WinUI/MacCatalyst); OnIdiom supplies values per device type (Phone/Tablet/Desktop/TV/Watch). They're used inline in XAML to tweak sizes, margins, or resources without code-behind branching.
<StackLayout Padding="{OnPlatform iOS='20,40,20,20',
Android='20'}"
Spacing="{OnIdiom Phone=8, Desktop=16}" />Real-world example Extra top padding accommodates the iOS status bar while Android uses uniform padding, and spacing grows on desktop.