Since iOS 10.3, developers are able to programmatically change the app icon.
For details,You may can refer to this link, it shows how to dynamically change the app icon.
Sample code:
// change app icon to "Picture A"
@IBAction func pichuButtonDidTap(_ sender: UIButton) {
changeIcon(to: "Picture A")
}
// change app icon to "Picture B"
@IBAction func pikachuButtonDidTap(_ sender: UIButton) {
changeIcon(to: "Picture B")
}
// change app icon to "Picture C"
@IBAction func raichuButtonDidTap(_ sender: UIButton) {
changeIcon(to: "Picture C")
}
func changeIcon(to iconName: String) {
// 1
guard UIApplication.shared.supportsAlternateIcons else {
return
}
// 2
UIApplication.shared.setAlternateIconName(iconName, completionHandler: { (error) in
// 3
if let error = error {
print("App icon failed to change due to \(error.localizedDescription)")
} else {
print("App icon changed successfully")
}
})
}