Canvatorium Visio Lab 5041
Utility Panel Window.
Create a utility window with the new utilityPanel Window Placement.
Setup a Window Group using defaultWindowPlacement
// App.swift
WindowGroup(id: "utility-demo") {
UtilityPlaceholderCardUnstyled()
}
.defaultWindowPlacement { content, context in
return WindowPlacement(.utilityPanel)
}
.defaultSize(CGSize(width: 480, height: 300))
Then open a new window using the ID assigned to the group
struct Lab5041: View {
@Environment(\.openWindow) private var openWindow
var body: some View {
VStack {
ProfilePlaceholderCardUnstyled()
Button(action: {
openWindow(id: "utility-demo")
}, label: {
Label("Open Utility Window", systemImage: "widget.extralarge.badge.plus")
})
.padding()
}
}
}