How do you provide an icon for an action extension?
First, you need to have an asset catalog. You may already have this but if you don't, this is easy to create.
Click on the group that contains the extension files.
From the File menu, select New > File....
In the iOS section, click on Asset Catalog and then click Next.
Second, we need to add the app icons to our project. Note that the icons must have a transparent background. If you try to use icons with a solid background, iOS will not display the icon.
Click the + button and choose App Icons & Launch Images > New iOS App Icon.
By default, Xcode will call the icon
AppIcon
but it will also warn you that this name is in use. To remove this warning, choose a different name (e.g.AppIconExtension-iOS
).Drag your icons into the 60px placeholder. You will also need 120x120 (aka @2x) and 180x180px (aka @3x) icons. You can create additional icons if you want but these are not necessary.
Third, you need to tell Xcode to use the icon when building the extension.
In the Project Navigator, select your project at the top of the tree.
Select your extension as the Target and select Build Settings.
Search for Primary App Icon Set Name (or Asset Catalog App Icon Set Name before Xcode 15) and enter the name of your icon.
- Build and run the extension.
In order to get it to work its not enough to add the assets to the asset catalog - its additionally necessary to set the Asset Catalog compiler options of Build Settings section of the extension to specify the name of the app icon set within the asset catalog:
We need a monochromatic icon for Extension application which has exactly same dimensions & type as we set on Appicon(Only name & icon type is differ). Firstly we need to include assets to the extension target
Step 1:- For adding assets click on extension scheme->Build phases ->Copy Bundle Resources ->Click + -> Add assets OR Just add by click on assets in your extension target membership.
refer below screen shot
Step 2:- Now for setting up extension App icon click on Extension application from targets area, Go to build settings ->Search Assets catalog compiler option ->Enter your App icon name
refer below screen shot