Deprecate frame(maxSize:) on views

This commit is contained in:
david-swift 2024-04-21 12:32:50 +02:00
parent b7aabb0966
commit 7ff56613e5
15 changed files with 18 additions and 68 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ DerivedData/
.Ulysses-Group.plist .Ulysses-Group.plist
/.docc-build /.docc-build
/io.github.AparokshaUI.Generation.json /io.github.AparokshaUI.Generation.json
/.vscode

52
.vscode/launch.json vendored
View File

@ -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"
}
]
}

View File

@ -27,6 +27,7 @@ extension View {
/// Set the view's maximum width. /// Set the view's maximum width.
/// - Parameter maxSize: The maximum width. /// - Parameter maxSize: The maximum width.
/// - Returns: A view. /// - Returns: A view.
@available(*, deprecated, message: "Use frame(maxWidth:) on views instead")
public func frame(maxSize: Int? = nil) -> Clamp { public func frame(maxSize: Int? = nil) -> Clamp {
frame(maxWidth: maxSize) frame(maxWidth: maxSize)
} }

View File

@ -20,7 +20,7 @@ struct AlertDialogDemo: View {
dialog = true dialog = true
} }
.style("pill") .style("pill")
.frame(maxSize: 100) .frame(maxWidth: 100)
.padding() .padding()
} }
.alertDialog(visible: $dialog, heading: "Alert Dialog", body: "This is an alert dialog") .alertDialog(visible: $dialog, heading: "Alert Dialog", body: "This is an alert dialog")

View File

@ -36,7 +36,7 @@ struct CarouselDemo: View {
.onClick { print(element.id) } .onClick { print(element.id) }
.padding(20) .padding(20)
.frame(minWidth: 300, minHeight: 200) .frame(minWidth: 300, minHeight: 200)
.frame(maxSize: 500) .frame(maxWidth: 500)
} }
.longSwipes() .longSwipes()
} }

View File

@ -22,7 +22,7 @@ struct DialogDemo: View {
dialog = true dialog = true
} }
.style("pill") .style("pill")
.frame(maxSize: 100) .frame(maxWidth: 100)
.padding() .padding()
} }
.dialog(visible: $dialog, title: "Counter", width: width, height: height) { .dialog(visible: $dialog, title: "Counter", width: width, height: height) {

View File

@ -28,7 +28,7 @@ struct DiceDemo: View {
} }
.style("pill") .style("pill")
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
.valign(.center) .valign(.center)
.padding() .padding()

View File

@ -19,7 +19,7 @@ struct FormDemo: View {
app.showWindow("form-demo") app.showWindow("form-demo")
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
} }
@ -62,7 +62,7 @@ struct FormDemo: View {
}) })
} }
.padding() .padding()
.frame(maxSize: 400) .frame(maxWidth: 400)
} }
.topToolbar { .topToolbar {
HeaderBar.empty() HeaderBar.empty()

View File

@ -19,7 +19,7 @@ struct NavigationViewDemo: View {
app.showWindow("navigation") app.showWindow("navigation")
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
.padding() .padding()
} }
} }

View File

@ -19,7 +19,7 @@ struct PopoverDemo: View {
visible = true visible = true
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
.popover(visible: $visible) { .popover(visible: $visible) {
CounterDemo() CounterDemo()
} }

View File

@ -19,7 +19,7 @@ struct ToastDemo: View {
toast.signal() toast.signal()
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
} }

View File

@ -19,7 +19,7 @@ struct ToolbarDemo: View {
app.showWindow("toolbar-demo") app.showWindow("toolbar-demo")
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
} }
@ -34,7 +34,7 @@ struct ToolbarDemo: View {
visible.toggle() visible.toggle()
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
.padding(15) .padding(15)
} }
.valign(.center) .valign(.center)

View File

@ -27,14 +27,14 @@ struct TransitionDemo: View {
} }
.modifyContent(Text.self) { $0.style("title-2").padding() } .modifyContent(Text.self) { $0.style("title-2").padding() }
.style("card") .style("card")
.frame(maxSize: 200) .frame(maxWidth: 200)
.padding() .padding()
Button("Toggle View") { Button("Toggle View") {
firstView.toggle() firstView.toggle()
} }
.style("pill") .style("pill")
.padding() .padding()
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
} }

View File

@ -19,7 +19,7 @@ struct ViewSwitcherDemo: View {
app.showWindow("switcher-demo") app.showWindow("switcher-demo")
} }
.style("suggested-action") .style("suggested-action")
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
} }

View File

@ -29,7 +29,7 @@ struct WindowsDemo: View {
.style("linked") .style("linked")
.padding() .padding()
} }
.frame(maxSize: 100) .frame(maxWidth: 100)
} }
struct WindowContent: View { struct WindowContent: View {