From 7ff56613e563c871389c0b2124900ed9084e657a Mon Sep 17 00:00:00 2001 From: david-swift Date: Sun, 21 Apr 2024 12:32:50 +0200 Subject: [PATCH] Deprecate frame(maxSize:) on views --- .gitignore | 3 +- .vscode/launch.json | 52 --------------------- Sources/Adwaita/View/Modifiers/Clamp+.swift | 1 + Tests/AlertDialogDemo.swift | 2 +- Tests/CarouselDemo.swift | 2 +- Tests/DialogDemo.swift | 2 +- Tests/DiceDemo.swift | 2 +- Tests/FormDemo.swift | 4 +- Tests/NavigationViewDemo.swift | 2 +- Tests/PopoverDemo.swift | 2 +- Tests/ToastDemo.swift | 2 +- Tests/ToolbarDemo.swift | 4 +- Tests/TransitionDemo.swift | 4 +- Tests/ViewSwitcherDemo.swift | 2 +- Tests/WindowsDemo.swift | 2 +- 15 files changed, 18 insertions(+), 68 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 9cdd5e8..e1c5612 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ DerivedData/ /Package.resolved .Ulysses-Group.plist /.docc-build -/io.github.AparokshaUI.Generation.json \ No newline at end of file +/io.github.AparokshaUI.Generation.json +/.vscode \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index cf34b8a..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "configurations": [ - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "args": [], - "cwd": "${workspaceFolder:adwaita-swift}", - "name": "Debug Generation", - "program": "${workspaceFolder:adwaita-swift}/.build/debug/Generation", - "preLaunchTask": "swift: Build Debug Generation" - }, - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "args": [], - "cwd": "${workspaceFolder:adwaita-swift}", - "name": "Release Generation", - "program": "${workspaceFolder:adwaita-swift}/.build/release/Generation", - "preLaunchTask": "swift: Build Release Generation" - }, - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "args": [], - "cwd": "${workspaceFolder:adwaita-swift}", - "name": "Debug Demo", - "program": "${workspaceFolder:adwaita-swift}/.build/debug/Demo", - "preLaunchTask": "swift: Build Debug Demo" - }, - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "args": [], - "cwd": "${workspaceFolder:adwaita-swift}", - "name": "Release Demo", - "program": "${workspaceFolder:adwaita-swift}/.build/release/Demo", - "preLaunchTask": "swift: Build Release Demo" - } - ] -} \ No newline at end of file diff --git a/Sources/Adwaita/View/Modifiers/Clamp+.swift b/Sources/Adwaita/View/Modifiers/Clamp+.swift index e2523fb..a8b1d02 100644 --- a/Sources/Adwaita/View/Modifiers/Clamp+.swift +++ b/Sources/Adwaita/View/Modifiers/Clamp+.swift @@ -27,6 +27,7 @@ extension View { /// Set the view's maximum width. /// - Parameter maxSize: The maximum width. /// - Returns: A view. + @available(*, deprecated, message: "Use frame(maxWidth:) on views instead") public func frame(maxSize: Int? = nil) -> Clamp { frame(maxWidth: maxSize) } diff --git a/Tests/AlertDialogDemo.swift b/Tests/AlertDialogDemo.swift index 348c8ab..5a95b8d 100644 --- a/Tests/AlertDialogDemo.swift +++ b/Tests/AlertDialogDemo.swift @@ -20,7 +20,7 @@ struct AlertDialogDemo: View { dialog = true } .style("pill") - .frame(maxSize: 100) + .frame(maxWidth: 100) .padding() } .alertDialog(visible: $dialog, heading: "Alert Dialog", body: "This is an alert dialog") diff --git a/Tests/CarouselDemo.swift b/Tests/CarouselDemo.swift index 6a5212a..9c4d3d9 100644 --- a/Tests/CarouselDemo.swift +++ b/Tests/CarouselDemo.swift @@ -36,7 +36,7 @@ struct CarouselDemo: View { .onClick { print(element.id) } .padding(20) .frame(minWidth: 300, minHeight: 200) - .frame(maxSize: 500) + .frame(maxWidth: 500) } .longSwipes() } diff --git a/Tests/DialogDemo.swift b/Tests/DialogDemo.swift index 65af03b..5b436e5 100644 --- a/Tests/DialogDemo.swift +++ b/Tests/DialogDemo.swift @@ -22,7 +22,7 @@ struct DialogDemo: View { dialog = true } .style("pill") - .frame(maxSize: 100) + .frame(maxWidth: 100) .padding() } .dialog(visible: $dialog, title: "Counter", width: width, height: height) { diff --git a/Tests/DiceDemo.swift b/Tests/DiceDemo.swift index aa5076d..9e0a873 100644 --- a/Tests/DiceDemo.swift +++ b/Tests/DiceDemo.swift @@ -28,7 +28,7 @@ struct DiceDemo: View { } .style("pill") .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) } .valign(.center) .padding() diff --git a/Tests/FormDemo.swift b/Tests/FormDemo.swift index b5b3cbc..b60472c 100644 --- a/Tests/FormDemo.swift +++ b/Tests/FormDemo.swift @@ -19,7 +19,7 @@ struct FormDemo: View { app.showWindow("form-demo") } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) } } @@ -62,7 +62,7 @@ struct FormDemo: View { }) } .padding() - .frame(maxSize: 400) + .frame(maxWidth: 400) } .topToolbar { HeaderBar.empty() diff --git a/Tests/NavigationViewDemo.swift b/Tests/NavigationViewDemo.swift index 9b0a32e..d0e32ac 100644 --- a/Tests/NavigationViewDemo.swift +++ b/Tests/NavigationViewDemo.swift @@ -19,7 +19,7 @@ struct NavigationViewDemo: View { app.showWindow("navigation") } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) .padding() } } diff --git a/Tests/PopoverDemo.swift b/Tests/PopoverDemo.swift index c42e0d3..732d51a 100644 --- a/Tests/PopoverDemo.swift +++ b/Tests/PopoverDemo.swift @@ -19,7 +19,7 @@ struct PopoverDemo: View { visible = true } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) .popover(visible: $visible) { CounterDemo() } diff --git a/Tests/ToastDemo.swift b/Tests/ToastDemo.swift index 12ce935..d811b2f 100644 --- a/Tests/ToastDemo.swift +++ b/Tests/ToastDemo.swift @@ -19,7 +19,7 @@ struct ToastDemo: View { toast.signal() } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) } } diff --git a/Tests/ToolbarDemo.swift b/Tests/ToolbarDemo.swift index 632396f..5b1e014 100644 --- a/Tests/ToolbarDemo.swift +++ b/Tests/ToolbarDemo.swift @@ -19,7 +19,7 @@ struct ToolbarDemo: View { app.showWindow("toolbar-demo") } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) } } @@ -34,7 +34,7 @@ struct ToolbarDemo: View { visible.toggle() } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) .padding(15) } .valign(.center) diff --git a/Tests/TransitionDemo.swift b/Tests/TransitionDemo.swift index 7a94428..07fa860 100644 --- a/Tests/TransitionDemo.swift +++ b/Tests/TransitionDemo.swift @@ -27,14 +27,14 @@ struct TransitionDemo: View { } .modifyContent(Text.self) { $0.style("title-2").padding() } .style("card") - .frame(maxSize: 200) + .frame(maxWidth: 200) .padding() Button("Toggle View") { firstView.toggle() } .style("pill") .padding() - .frame(maxSize: 100) + .frame(maxWidth: 100) } } diff --git a/Tests/ViewSwitcherDemo.swift b/Tests/ViewSwitcherDemo.swift index c35d56f..a8b0b08 100644 --- a/Tests/ViewSwitcherDemo.swift +++ b/Tests/ViewSwitcherDemo.swift @@ -19,7 +19,7 @@ struct ViewSwitcherDemo: View { app.showWindow("switcher-demo") } .style("suggested-action") - .frame(maxSize: 100) + .frame(maxWidth: 100) } } diff --git a/Tests/WindowsDemo.swift b/Tests/WindowsDemo.swift index c03115b..9b5c763 100644 --- a/Tests/WindowsDemo.swift +++ b/Tests/WindowsDemo.swift @@ -29,7 +29,7 @@ struct WindowsDemo: View { .style("linked") .padding() } - .frame(maxSize: 100) + .frame(maxWidth: 100) } struct WindowContent: View {