Skip to content

Commit 4db9679

Browse files
committed
Add About window with author and project information
- Added About menu item in application menu - Created AboutView with app information - Included author: Jia Xianhua - Added GitHub project repository link - Displays app version and description - Added copyright information
1 parent 9d79508 commit 4db9679

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

Hash/HashApp.swift

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,85 @@ struct HashApp: App {
2424
.windowResizability(.contentSize)
2525
.commands {
2626
CommandGroup(replacing: .newItem) { }
27+
CommandGroup(replacing: .appInfo) {
28+
Button("About Hash") {
29+
showAboutWindow()
30+
}
31+
}
2732
}
2833
}
34+
35+
private func showAboutWindow() {
36+
let aboutWindow = NSWindow(
37+
contentRect: NSRect(x: 0, y: 0, width: 400, height: 300),
38+
styleMask: [.titled, .closable],
39+
backing: .buffered,
40+
defer: false
41+
)
42+
aboutWindow.title = "About Hash"
43+
aboutWindow.center()
44+
aboutWindow.isReleasedWhenClosed = false
45+
46+
let aboutView = AboutView()
47+
aboutWindow.contentView = NSHostingView(rootView: aboutView)
48+
aboutWindow.makeKeyAndOrderFront(nil)
49+
}
50+
}
51+
52+
struct AboutView: View {
53+
var body: some View {
54+
VStack(spacing: 20) {
55+
// App Icon
56+
Image(systemName: "number.square")
57+
.font(.system(size: 64))
58+
.foregroundColor(.blue)
59+
60+
// App Name and Version
61+
VStack(spacing: 8) {
62+
Text("Hash")
63+
.font(.title)
64+
.fontWeight(.bold)
65+
66+
Text("Version 1.0.0")
67+
.font(.subheadline)
68+
.foregroundColor(.secondary)
69+
}
70+
71+
// Description
72+
Text("A concise and efficient macOS hash calculation tool")
73+
.font(.body)
74+
.multilineTextAlignment(.center)
75+
.padding(.horizontal)
76+
77+
Divider()
78+
79+
// Author and Project Info
80+
VStack(spacing: 12) {
81+
HStack {
82+
Text("Author:")
83+
.fontWeight(.medium)
84+
Spacer()
85+
Text("Jia Xianhua")
86+
}
87+
88+
HStack {
89+
Text("Project:")
90+
.fontWeight(.medium)
91+
Spacer()
92+
Link("GitHub Repository", destination: URL(string: "https://github.com/iOSDevLog/Hash")!)
93+
.foregroundColor(.blue)
94+
}
95+
}
96+
.padding(.horizontal)
97+
98+
Spacer()
99+
100+
// Copyright
101+
Text("© 2025 Hash Project Contributors")
102+
.font(.caption)
103+
.foregroundColor(.secondary)
104+
}
105+
.padding()
106+
.frame(width: 400, height: 300)
107+
}
29108
}

0 commit comments

Comments
 (0)