got it to return the high quality icon from the asset catalog

made the about view look nicer
This commit is contained in:
neon443
2025-08-03 10:36:01 +01:00
parent 425e03223e
commit 18d708cf0c
3 changed files with 22 additions and 10 deletions

View File

@@ -22,9 +22,10 @@ extension Bundle {
extension UIImage {
var appIcon: Image {
let fallback = Image(uiImage: UIImage())
guard let filename = Bundle.main.iconFilename else { return fallback }
guard let uiImage = UIImage(named: filename) else { return fallback }
return Image(uiImage: uiImage)
// let fallback = Image(uiImage: UIImage())
// guard let filename = Bundle.main.iconFilename else { return fallback }
// guard let uiImage = UIImage(named: filename) else { return fallback }
// return uiImage
return Image("Icon")
}
}

View File

@@ -8,15 +8,26 @@
import SwiftUI
struct AboutView: View {
@ObservedObject var hostsManager: HostsManager
var body: some View {
HStack {
UIImage().appIcon
Image(uiImage: UIImage(named: "AppIcon") ?? UIImage())
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
ZStack {
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
.ignoresSafeArea(.all)
List {
HStack {
UIImage().appIcon
.resizable().scaledToFit()
.frame(width: 100)
.clipShape(RoundedRectangle(cornerRadius: 26))
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
.scrollContentBackground(.hidden)
}
}
}
#Preview {
AboutView()
AboutView(hostsManager: HostsManager())
}

View File

@@ -65,7 +65,7 @@ struct ContentView: View {
Section {
NavigationLink {
AboutView()
AboutView(hostsManager: hostsManager)
} label: {
Label("About", systemImage: "info.square")
}