iosswiftuikituiapplicationappicon

Use image file from "Assets.xcassets" for changing iOS app icon programmatically


I'm trying to develop Icon Changing feature and I was going to use images from Assets.xcassets as app icon image.

I tried changing app icon using setAlternateIconName(_:completionHandler:) after adding CFBundleAlternateIcons data to info.plist But Xcode and iOS System cannot detect image file from Assets.xcassets. I want to use image from Assets.xcassets as App icon. Is there any way?

Thanks in advance


Solution

  • No, you cannot use assets for that. But if your purpose is to adapt images for devices. Just add a suffix ( for example -@1x.png , -@2x.png, -@3x.png)

    Check this link for details