diff --git a/IceCubesApp/App/Tabs/Settings/IconSelectorView.swift b/IceCubesApp/App/Tabs/Settings/IconSelectorView.swift index 03d9e8ee..0b6f00ca 100644 --- a/IceCubesApp/App/Tabs/Settings/IconSelectorView.swift +++ b/IceCubesApp/App/Tabs/Settings/IconSelectorView.swift @@ -6,11 +6,21 @@ struct IconSelectorView: View { self.rawValue } - case primary = "AppIconInApp" + case primary = "AppIcon" case alternate1 = "AppIconAlternate1" case alternate2 = "AppIconAlternate2" case alternate3 = "AppIconAlternate3" case alternate4 = "AppIconAlternate4" + + var iconName: String { + switch self { + case .primary: return "icon0" + case .alternate1: return "icon1" + case .alternate2: return "icon2" + case .alternate3: return "icon3" + case .alternate4: return "icon4" + } + } } @State private var currentIcon = UIApplication.shared.alternateIconName ?? Icon.primary.rawValue @@ -31,7 +41,7 @@ struct IconSelectorView: View { } } label: { ZStack(alignment: .bottomTrailing) { - Image(uiImage: .init(named: icon.rawValue) ?? .init()) + Image(uiImage: .init(named: icon.iconName) ?? .init()) .resizable() .aspectRatio(contentMode: .fit) .frame(minHeight: 125, maxHeight: 1024) diff --git a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift index 86587729..c2007ea9 100644 --- a/IceCubesApp/App/Tabs/Settings/SettingsTab.swift +++ b/IceCubesApp/App/Tabs/Settings/SettingsTab.swift @@ -96,10 +96,12 @@ struct SettingsTabs: View { Label { Text("Icon selector") } icon: { - Image(uiImage: .init(named: UIApplication.shared.alternateIconName ?? "AppIconInApp")!) - .resizable() - .frame(width: 25, height: 25) - .cornerRadius(4) + if let icon = IconSelectorView.Icon(rawValue: UIApplication.shared.alternateIconName ?? "AppIcon") { + Image(uiImage: .init(named: icon.iconName)!) + .resizable() + .frame(width: 25, height: 25) + .cornerRadius(4) + } } } Link(destination: URL(string: "https://github.com/Dimillian/IceCubesApp")!) { diff --git a/IceCubesApp/Assets.xcassets/AppIconInApp.imageset/Contents.json b/IceCubesApp/Assets.xcassets/icon0.imageset/Contents.json similarity index 100% rename from IceCubesApp/Assets.xcassets/AppIconInApp.imageset/Contents.json rename to IceCubesApp/Assets.xcassets/icon0.imageset/Contents.json diff --git a/IceCubesApp/Assets.xcassets/AppIconInApp.imageset/icon.png b/IceCubesApp/Assets.xcassets/icon0.imageset/icon.png similarity index 100% rename from IceCubesApp/Assets.xcassets/AppIconInApp.imageset/icon.png rename to IceCubesApp/Assets.xcassets/icon0.imageset/icon.png diff --git a/IceCubesApp/Assets.xcassets/icon1.imageset/Contents.json b/IceCubesApp/Assets.xcassets/icon1.imageset/Contents.json new file mode 100644 index 00000000..2945b36b --- /dev/null +++ b/IceCubesApp/Assets.xcassets/icon1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IceCubesApp/Assets.xcassets/icon1.imageset/icon.png b/IceCubesApp/Assets.xcassets/icon1.imageset/icon.png new file mode 100644 index 00000000..a2a93988 Binary files /dev/null and b/IceCubesApp/Assets.xcassets/icon1.imageset/icon.png differ diff --git a/IceCubesApp/Assets.xcassets/icon2.imageset/Contents.json b/IceCubesApp/Assets.xcassets/icon2.imageset/Contents.json new file mode 100644 index 00000000..2945b36b --- /dev/null +++ b/IceCubesApp/Assets.xcassets/icon2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IceCubesApp/Assets.xcassets/icon2.imageset/icon.png b/IceCubesApp/Assets.xcassets/icon2.imageset/icon.png new file mode 100644 index 00000000..ba115a3b Binary files /dev/null and b/IceCubesApp/Assets.xcassets/icon2.imageset/icon.png differ diff --git a/IceCubesApp/Assets.xcassets/icon3.imageset/Contents.json b/IceCubesApp/Assets.xcassets/icon3.imageset/Contents.json new file mode 100644 index 00000000..2945b36b --- /dev/null +++ b/IceCubesApp/Assets.xcassets/icon3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IceCubesApp/Assets.xcassets/icon3.imageset/icon.png b/IceCubesApp/Assets.xcassets/icon3.imageset/icon.png new file mode 100644 index 00000000..7b34ce23 Binary files /dev/null and b/IceCubesApp/Assets.xcassets/icon3.imageset/icon.png differ diff --git a/IceCubesApp/Assets.xcassets/icon4.imageset/Contents.json b/IceCubesApp/Assets.xcassets/icon4.imageset/Contents.json new file mode 100644 index 00000000..2945b36b --- /dev/null +++ b/IceCubesApp/Assets.xcassets/icon4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IceCubesApp/Assets.xcassets/icon4.imageset/icon.png b/IceCubesApp/Assets.xcassets/icon4.imageset/icon.png new file mode 100644 index 00000000..e5034f3e Binary files /dev/null and b/IceCubesApp/Assets.xcassets/icon4.imageset/icon.png differ