Skip to content

Commit

Permalink
Added app icons as a preview in ChooseAppIcon view (#338)
Browse files Browse the repository at this point in the history
* Added app icons imageset as a preview
  • Loading branch information
mitaligondaliya authored Oct 21, 2024
1 parent 5e5ed93 commit a59cbca
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"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" : [
{
"filename" : "AppIcon-Image@3x.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "AppIcon-Original-Dark.png",
"idiom" : "universal"
}
],
"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" : [
{
"filename" : "AppIcon-Image-Car-Black@3x.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "Black-Dark.png",
"idiom" : "universal"
}
],
"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" : [
{
"filename" : "AppIcon-Image-Car-Orange@3x.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "AppIcon-Image-Car-Dark@3x.png",
"idiom" : "universal"
}
],
"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" : [
{
"filename" : "AppIcon-Image-Car-Red@3x.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "AppIcon-Image-Car-Dark@3x.png",
"idiom" : "universal"
}
],
"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" : [
{
"filename" : "AppIcon-Image-Car-Yellow@3x.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "AppIcon-Image-Car-Dark@3x.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
15 changes: 13 additions & 2 deletions Basic-Car-Maintenance/Shared/Models/AppIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,18 @@ enum AppIcon: String, CaseIterable, Identifiable {
}
}

var preview: UIImage {
UIImage(named: rawValue) ?? UIImage()
var previewImage: String {
switch self {
case .primary:
return "Preview-appIcon"
case .carRed:
return "Preview-car-red"
case .carYellow:
return "Preview-car-yellow"
case .carBlack:
return "Preview-car-black"
case .carOrange:
return "Preview-car-orange"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extension ChooseAppIconView {
Text(icon.description)
Spacer()
}
Image(uiImage: icon.preview)
Image(icon.previewImage)
.resizable()
.aspectRatio(contentMode: .fit)
.clipShape(.rect(cornerRadius: 20))
Expand Down

0 comments on commit a59cbca

Please sign in to comment.