mirror of
https://github.com/neon443/ShhShell.git
synced 2026-11-30 12:44:51 +00:00
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:
1 parent
2290a5c275
commit
7850a3839a
4 files changed
+92
-14
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||