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

3
.gitignore vendored
View File

@ -10,4 +10,5 @@ DerivedData/
/Package.resolved
.Ulysses-Group.plist
/.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.
/// - 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)
}

View File

@ -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")

View File

@ -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()
}

View File

@ -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) {

View File

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

View File

@ -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()

View File

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

View File

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

View File

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

View File

@ -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)

View File

@ -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)
}
}

View File

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

View File

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