Skip to content

Commit 044efa4

Browse files
patch (settings): match window resizing behaviour to that of macOS Settings
1 parent 24e2a63 commit 044efa4

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Swiftcord/SwiftcordApp.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ let appName = Bundle.main.infoDictionary?[kCFBundleNameKey as String] as? String
1616
// MARK: Global Objects
1717
let restAPI = DiscordREST()
1818

19+
fileprivate extension Scene {
20+
func contentSizedWindowResizability() -> some Scene {
21+
if #available(macOS 13.0, *) {
22+
return self.windowResizability(.contentSize)
23+
} else {
24+
return self
25+
}
26+
}
27+
}
28+
1929
@main
2030
struct SwiftcordApp: App {
2131
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@@ -115,7 +125,7 @@ struct SwiftcordApp: App {
115125
? .dark
116126
: (selectedTheme == "light" ? .light : .none)
117127
)
118-
}
128+
}.contentSizedWindowResizability()
119129
}
120130
}
121131

Swiftcord/Views/Settings/SettingsView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private extension SettingsView {
177177
navigationItem(item: child)
178178
}
179179
}
180-
}.frame(idealWidth: 215)
180+
}.navigationSplitViewColumnWidth(215)
181181
} detail: {
182182
ScrollView {
183183
Group {
@@ -194,10 +194,11 @@ private extension SettingsView {
194194
Text("Unimplemented view: \(selectedPage.name.rawValue)")
195195
}
196196
}.padding(20)
197-
}
197+
}.navigationSplitViewColumnWidth(500)
198198
}
199199
.searchable(text: $filter, placement: .sidebar)
200200
.navigationTitle(selectedPage.nameString)
201+
.frame(minHeight: 470)
201202
}
202203
}
203204

Swiftcord/Views/Settings/User/UserSettingsAccountView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct UserSettingsAccountView: View {
5151

5252
GroupBox {
5353
VStack(alignment: .leading, spacing: 4) {
54-
5554
Text("settings.user.phoneNum").textCase(.uppercase).font(.headline).opacity(0.75)
5655
Text(user.phone ?? "You haven't added a phone number yet.")
5756
.font(.system(size: 16))

Swiftcord/Views/Settings/User/UserSettingsProfileView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ struct UserSettingsProfileView: View {
1616

1717
var body: some View {
1818
VStack(alignment: .leading, spacing: 16) {
19-
Text("User Profile").font(.title)
20-
2119
HStack(alignment: .top) {
2220
VStack(alignment: .leading) {
2321
Text("About Me").textCase(.uppercase).font(.headline)

0 commit comments

Comments
 (0)