Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@saamerm
Created December 5, 2020 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saamerm/fe1f4c20f731525480c6f59c578b6162 to your computer and use it in GitHub Desktop.
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
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