Alternate App Icons using Asset Catalogs in Xcode 13

If you had ever tried to add Alternate App Icons prior to WWDC 2021, you would have likely been frustrated after finding out alternate app icons must be added to the target file by file, without any easy way to see if you covered all the different sizes, and you had to manually define the structure for each icon in the Info.plist file.

The root key name even suggests this method of specifying app icons has been deprecated.

Well, no more! As of Xcode 13, Asset Catalogs now support Alternate App Icons and there’s a corresponding build setting to enable the feature:

At runtime, your app can now use iOS app icon assets from its asset catalog as alternate app icons. A new build setting, “Include all app icon assets,” controls whether Xcode includes all app icon sets in the built product. When the setting is disabled [sic], Xcode includes the primary app icon, along with the icons specified in the new setting, “Alternate app icon sets.” The asset catalog compiler inserts the appropriate content into the Info.plist of the built product. (33600923)

To show you exactly how this works, here’s a sample app made with SwiftUI:

The code for this app is the same as it would have been with versions prior to Xcode 13, except RelationshipIcon now refers to a new App Icon I’ve added to my default Asset Catalog:

And finally, to put it all together, we need to make some changes the target’s Build Settings.

First, in your project’s xcodeproj configuration, select the Build Settings tab.

If you want to include all App Icon Assets:

  1. Under the Asset Catalog Compiler — Options group, change “Include All App Icon Assets” to Yes.

If you only want to include some of the App Icon Assets (Thank you Jonathon Mahh for this correction!):

  1. Under the Asset Catalog Compiler — Options group, make sure “Include All App Icon Assets” is No.
  2. Under the same group, add the names of your assets (the ones you used in the Asset Catalog) to “Alternate App Icon Sets”. Here I’ve only added RelationshipIcon but the option supports adding multiple icons.

And, voila!

The best part is that the new feature is in the build process itself, so you can start using this now with any apps targeting iOS 10.3 or later.

--

--

--

Senior Staff Mobile Engineer @ Udemy, interests in cats, travel, and food

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Automate framework generation for a modular iOS project

How to create a custom Cordova Plugin in iOS Swift

Modeling DataSource. Part 2.

Clear and searchable logging in Swift with OSLog

Internationalization of iOS Apps using Swift (Part-1)

Live graph using CorePlot in iOS

iOS 16: Apple’s new software update comes with a dash of Android

Swift: 3D looking animated Globe🌍 with CALayer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Terrence Katzenbaer

Terrence Katzenbaer

Senior Staff Mobile Engineer @ Udemy, interests in cats, travel, and food

More from Medium

Localization on iOS

👾 Apollo Integration Fun on iOS

(iOS)Manage Firebase environments for Development & Production effectively 🎯

Everyone can code Puzzles — Hypocycloid