Created
December 5, 2020 01:43
-
-
Save saamerm/fe1f4c20f731525480c6f59c578b6162 to your computer and use it in GitHub Desktop.
iOS Native Service that is connected to the Xamarin.Forms in order to progr.ammatically switch the App Icon after user installation. This is useful for allowing the user to personalize their app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using AppIconUpdater.iOS; | |
using Xamarin.Forms; | |
using ui = UIKit.UIApplication; | |
[assembly: Dependency(typeof(IconSwitchService))] | |
namespace {YourNamespace}.iOS | |
{ | |
public class IconSwitchService : IIconSwitchService | |
{ | |
public async Task SwitchAppIconAsync(string iconName) | |
{ | |
if (ui.SharedApplication.SupportsAlternateIcons){ | |
await ui.SharedApplication.SetAlternateIconNameAsync(iconName); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment