icons: change app icon screen was not showing icon previews - added tiny 75x75 imageset assets since iOS 18+ cannot use AppIconSet for UIImage(named:)

This commit is contained in:
mahee96
2026-02-22 10:58:32 +05:30
parent d18422af00
commit 7683447eea
49 changed files with 183 additions and 12 deletions

View File

@@ -8,6 +8,8 @@
<key>name</key>
<string>Original</string>
<key>imageName</key>
<string>App</string>
<key>iconName</key>
<string>AppIcon</string>
</dict>
</array>
@@ -18,66 +20,88 @@
<string>Blue</string>
<key>imageName</key>
<string>Blue</string>
<key>iconName</key>
<string>BlueIcon</string>
</dict>
<dict>
<key>name</key>
<string>Dark</string>
<key>imageName</key>
<string>Dark</string>
<key>iconName</key>
<string>DarkIcon</string>
</dict>
<dict>
<key>name</key>
<string>Honeydew</string>
<key>imageName</key>
<string>Honeydew</string>
<key>iconName</key>
<string>HoneydewIcon</string>
</dict>
<dict>
<key>name</key>
<string>Pride</string>
<key>imageName</key>
<string>Pride</string>
<key>iconName</key>
<string>PrideIcon</string>
</dict>
<dict>
<key>name</key>
<string>Sandy</string>
<key>imageName</key>
<string>Sandy</string>
<key>iconName</key>
<string>SandyIcon</string>
</dict>
<dict>
<key>name</key>
<string>Sky</string>
<key>imageName</key>
<string>Sky</string>
<key>iconName</key>
<string>SkyIcon</string>
</dict>
<dict>
<key>name</key>
<string>Snow</string>
<key>imageName</key>
<string>Snow</string>
<key>iconName</key>
<string>SnowIcon</string>
</dict>
<dict>
<key>name</key>
<string>Starburst</string>
<key>imageName</key>
<string>Starburst</string>
<key>iconName</key>
<string>StarburstIcon</string>
</dict>
<dict>
<key>name</key>
<string>Storm</string>
<key>imageName</key>
<string>Storm</string>
<key>iconName</key>
<string>StormIcon</string>
</dict>
<dict>
<key>name</key>
<string>Vista</string>
<key>imageName</key>
<string>Vista</string>
<key>iconName</key>
<string>VistaIcon</string>
</dict>
<dict>
<key>name</key>
<string>Winter</string>
<key>imageName</key>
<string>Winter</string>
<key>iconName</key>
<string>WinterIcon</string>
</dict>
</array>
</dict>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "1024.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Blue.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

Before

Width:  |  Height:  |  Size: 313 KiB

After

Width:  |  Height:  |  Size: 313 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Dark.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Honeydew.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Pride.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 719 KiB

After

Width:  |  Height:  |  Size: 719 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Sandy.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 352 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Sky.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Snow.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Before

Width:  |  Height:  |  Size: 453 KiB

After

Width:  |  Height:  |  Size: 453 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Starburst.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Storm.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 464 KiB

After

Width:  |  Height:  |  Size: 464 KiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Vista.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Winter.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -20,15 +20,17 @@ extension UIApplication
private final class AltIcon: Decodable
{
static let defaultIconName: String = "AppIcon"
static let defaultName: String = "Original"
var name: String
var imageName: String
var iconName: String
private enum CodingKeys: String, CodingKey
{
case name
case imageName
case iconName
}
required init(from decoder: Decoder) throws
@@ -36,6 +38,7 @@ private final class AltIcon: Decodable
let container = try decoder.container(keyedBy: CodingKeys.self)
self.name = try container.decode(String.self, forKey: .name)
self.imageName = try container.decode(String.self, forKey: .imageName)
self.iconName = try container.decode(String.self, forKey: .iconName)
}
}
@@ -146,20 +149,14 @@ private extension AltAppIconsViewController
config.textProperties.font = font
config.textProperties.color = .label
// we have to do this hardcodded name hack for .appiconset
// else one can supply the artifacts via .imageset
let image: UIImage? =
UIImage(named: "\(icon.imageName)76x76@2x~ipad") ??
UIImage(named: "\(icon.imageName)60x60@2x") ??
UIImage(named: icon.imageName)
let image = UIImage(named: icon.imageName)
config.image = image
config.imageProperties.maximumSize = CGSize(width: imageWidth, height: imageWidth)
config.imageProperties.cornerRadius = imageWidth / 5.0 // Copied from AppIconImageView
cell.contentConfiguration = config
if UIApplication.shared.alternateIconName == icon.imageName || (UIApplication.shared.alternateIconName == nil && icon.imageName == AltIcon.defaultIconName)
if UIApplication.shared.alternateIconName == icon.iconName || (UIApplication.shared.alternateIconName == nil && icon.name == AltIcon.defaultName)
{
cell.accessories = [.checkmark(options: .init(tintColor: .white))]
}
@@ -167,7 +164,7 @@ private extension AltAppIconsViewController
{
cell.accessories = []
}
var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell()
backgroundConfiguration.backgroundColorTransformer = UIConfigurationColorTransformer { [weak cell] c in
if let state = cell?.configurationState, state.isHighlighted
@@ -205,8 +202,8 @@ extension AltAppIconsViewController
collectionView.reloadData()
// If assigning primary icon, pass "nil" as alternate icon name.
let imageName = (icon.imageName == "AppIcon") ? nil : icon.imageName
UIApplication.shared.setAlternateIconName(imageName) { error in
let iconName = (icon.name == AltIcon.defaultName) ? nil : icon.iconName
UIApplication.shared.setAlternateIconName(iconName) { error in
if let error
{
let alertController = UIAlertController(title: NSLocalizedString("Unable to Change App Icon", comment: ""),