Computer Magic Logo
Execute different code for each platform

Sunday, April 10, 2016

Published by Aristotelis Pitaridis

The Device.OnPlatform member function can be used in order to execute different lines of code depending on the operating system.

Device.OnPlatform(
    iOS: () =>
    {
        // iOS code
    },
    Android: () =>
    {
        // Android code
    },
    WinPhone: () =>
    {
        // Windows code
    });