- Update plist file
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Yalla</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Yalla</string>
</array>
</dict>
<key>Yo</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Yo</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string></string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
- Set alternate icon
guard let name = name else {
// Reset to default
UIApplication.shared.setAlternateIconName(nil)
return
}
UIApplication.shared.setAlternateIconName(name){ error in
if let error = error {
print(error.localizedDescription)
}
}
- You cannot change the app icon in background. An alert message shows when the icon is changed.