Skip to content

Commit

Permalink
Fix display of app icons for iOS 18
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Sep 23, 2024
1 parent 31d85dd commit 43ee1b6
Show file tree
Hide file tree
Showing 38 changed files with 267 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "snow [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "snow [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import UIKit
class AppIconManager {
static let allAppIcons: [AppIcon] = [
.main,
.alternate(name: "AppIconDark", title: "Dark"),
.alternate(name: "AppIconMono", title: "Mono"),
.alternate(name: "AppIconLeo", title: "Leo"),
.alternate(name: "AppIconMustang", title: "Mustang"),
.alternate(name: "AppIconYak", title: "Yak"),
.alternate(name: "AppIconPunk", title: "Punk"),
.alternate(name: "AppIcon1874", title: "#1874"),
.alternate(name: "AppIcon8ball", title: "8ball"),
.alternate(name: "AppIconIvfun", title: "Ivfun"),
.alternate(name: "AppIconDuck", title: "Duck"),
.alternate(name: "AppIconDark", imageName: "app_icon_dark", title: "Dark"),
.alternate(name: "AppIconMono", imageName: "app_icon_mono", title: "Mono"),
.alternate(name: "AppIconLeo", imageName: "app_icon_leo", title: "Leo"),
.alternate(name: "AppIconMustang", imageName: "app_icon_mustang", title: "Mustang"),
.alternate(name: "AppIconYak", imageName: "app_icon_yak", title: "Yak"),
.alternate(name: "AppIconPunk", imageName: "app_icon_punk", title: "Punk"),
.alternate(name: "AppIcon1874", imageName: "app_icon_1874", title: "#1874"),
.alternate(name: "AppIcon8ball", imageName: "app_icon_8ball", title: "8ball"),
.alternate(name: "AppIconIvfun", imageName: "app_icon_ivfun", title: "Ivfun"),
.alternate(name: "AppIconDuck", imageName: "app_icon_duck", title: "Duck"),
]

private let appIconRelay = PublishRelay<AppIcon>()
Expand Down
14 changes: 7 additions & 7 deletions UnstoppableWallet/UnstoppableWallet/Models/AppIcon.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
enum AppIcon {
case main
case alternate(name: String, title: String)
case alternate(name: String, imageName: String, title: String)

var name: String? {
switch self {
case .main: return nil
case let .alternate(name, _): return name
case let .alternate(name, _, _): return name
}
}

var title: String {
switch self {
case .main: return "Main"
case let .alternate(_, title): return title
case let .alternate(_, _, title): return title
}
}

var imageName: String {
switch self {
case .main: return "AppIcon"
case let .alternate(name, _): return name
case .main: return "app_icon_main"
case let .alternate(_, imageName, _): return imageName
}
}
}
Expand All @@ -29,7 +29,7 @@ extension AppIcon: Hashable {
switch self {
case .main:
hasher.combine("main")
case let .alternate(name, _):
case let .alternate(name, _, _):
hasher.combine("alternate")
hasher.combine(name)
}
Expand All @@ -40,7 +40,7 @@ extension AppIcon: Equatable {
public static func == (lhs: AppIcon, rhs: AppIcon) -> Bool {
switch (lhs, rhs) {
case (.main, .main): return true
case let (.alternate(lhsName, _), .alternate(rhsName, _)): return lhsName == rhsName
case let (.alternate(lhsName, _, _), .alternate(rhsName, _, _)): return lhsName == rhsName
default: return false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct AppearanceView: View {
viewModel.appIcon = appIcon
}) {
VStack(spacing: .margin12) {
Image(uiImage: UIImage(named: appIcon.imageName) ?? UIImage())
Image(appIcon.imageName)
.resizable()
.scaledToFit()
.clipShape(RoundedRectangle(cornerRadius: .cornerRadius12, style: .continuous))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct ReceiveAddressView: View {
.padding(.margin2)
.background(Color.white)

Image(uiImage: UIImage(named: AppIcon.main.imageName) ?? UIImage())
Image(AppIcon.main.imageName)
.resizable()
.scaledToFit()
.frame(width: appIconSize, height: appIconSize)
Expand Down

0 comments on commit 43ee1b6

Please sign in to comment.