Since iOS 10.3, it is possible to change the application's icon programmatically. This repository contains simple application demo it.
- Xcode 8.3 or higher.
- iOS 10.3 or higher.
- Install cocoapods (if needed) .
- Clone this project.
- Redirect to
/Project
directory. pod install
.- Open
AlternativeIconExample.xcworkspace
with Xcode. - Build and run on your device or simulator.
-
Import your alternative icon files to project file.
- IMPORTANT I don't know why, but it doesn't support
.xcassets
.
- IMPORTANT I don't know why, but it doesn't support
-
Open your project's
Info.plist
file.<key>CFBundleIcons</key> <dict> <key>CFBundleAlternateIcons</key> <dict> <key>{alternate-icon-key}</key> <dict> <key>CFBundleIconFiles</key> <array> <string>{alternate-icon-file-name}</string> </array> <key>UIPrerenderedIcon</key> <false/> </dict> </dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>{primary-icon-file-name}</string> </array> <key>UIPrerenderedIcon</key> <false/> </dict> </dict>
-
Write some code to set alternative icon.
UIApplication.shared.setAlternateIconName("alternative-icon-key") { error in // Handle error or do something. }
- The icon must to be user-choosable.
- The icon must to be related to your app.
- Click here to show more details.
AlternativeIcon-Example is available under the MIT license. See the LICENSE file for more info.