added a basic about thingy

- added a Bundle.swift to manage getting info from the Bundle.main.infoDictionary
 - extended UIImage to show the app's icon via UIImage().appIcon
This commit is contained in:
neon443 committed 2025-08-02 20:45:45 +01:00
1 parent 2290a5c275
commit 7850a3839a
4 files changed
+92 -14

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
//
// Bundle.swift
// ShhShell
//
// Created by neon443 on 02/08/2025.
//
import Foundation
import SwiftUI
//app icon
extension Bundle {
var iconFilename: String? {
guard let icons = infoDictionary?["CFBundleIcons"] as? [String: Any],
let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any],
let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String],
let iconFileName = iconFiles.last
else { return nil }
return iconFileName
}
}
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)
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.