fix(app): show the actual running app icon in About, not a named lookup
NSImage(named: "AppIcon") doesn't reliably resolve an App Icon asset-catalog entry on macOS (it stayed nil / fell back to the SF Symbol placeholder even with a valid icon in the catalog). NSApp.applicationIconImage is guaranteed to match whatever the Dock and Finder are actually showing for the running app.
This commit is contained in:
@@ -28,16 +28,13 @@ struct AboutView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
if let appIcon = NSImage(named: "AppIcon") {
|
// `NSImage(named: "AppIcon")` doesn't reliably resolve an App
|
||||||
Image(nsImage: appIcon)
|
// Icon asset-catalog entry on macOS — `NSApp.applicationIconImage`
|
||||||
|
// is the API that's actually guaranteed to match what the Dock
|
||||||
|
// and Finder show for the running app.
|
||||||
|
Image(nsImage: NSApp.applicationIconImage)
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: 80, height: 80)
|
.frame(width: 80, height: 80)
|
||||||
} else {
|
|
||||||
Image(systemName: "text.book.closed.fill")
|
|
||||||
.font(.system(size: 48))
|
|
||||||
.foregroundStyle(Color.accentColor)
|
|
||||||
.frame(width: 80, height: 80)
|
|
||||||
}
|
|
||||||
|
|
||||||
VStack(spacing: 4) {
|
VStack(spacing: 4) {
|
||||||
Text(appName)
|
Text(appName)
|
||||||
|
|||||||
Reference in New Issue
Block a user