Parcourir la source

Set default window size to match the app layout while keeping it resizable.

Centralize dimensions in AppWindow so the app launches at 1140×720 with that size as the minimum, allowing users to grow the window as needed.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 il y a 1 mois
Parent
commit
24ed8627bc

+ 1 - 1
Reddit App/App/RedditAppApp.swift

@@ -6,7 +6,7 @@ struct RedditAppApp: App {
         WindowGroup {
             FrontPageView()
         }
-        .defaultSize(width: 1440, height: 900)
+        .defaultSize(width: AppWindow.width, height: AppWindow.height)
         .windowStyle(.hiddenTitleBar)
     }
 }

+ 8 - 0
Reddit App/Utilities/AppWindow.swift

@@ -0,0 +1,8 @@
+import CoreGraphics
+
+enum AppWindow {
+    static let width: CGFloat = 1140
+    static let height: CGFloat = 720
+    static let minWidth: CGFloat = width
+    static let minHeight: CGFloat = height
+}

+ 2 - 2
Reddit App/Views/FrontPageView.swift

@@ -10,7 +10,7 @@ struct FrontPageView: View {
             mainContent
                 .frame(maxWidth: .infinity, maxHeight: .infinity)
         }
-        .frame(minWidth: 900, minHeight: 700)
+        .frame(minWidth: AppWindow.minWidth, minHeight: AppWindow.minHeight)
         .background(AppTheme.background)
     }
 
@@ -56,5 +56,5 @@ private struct ToolPlaceholderView: View {
 
 #Preview {
     FrontPageView()
-        .frame(width: 1200, height: 900)
+        .frame(width: AppWindow.width, height: AppWindow.height)
 }