Swift95

Workspace​Window​Actions95

Environment actions that close or minimize the containing logical window.

WorkspaceWindowActions95 gives deeply nested content a route-independent way to target the window currently hosting it.

Use it

import Swift95
import SwiftUI

struct WorkspaceWindowActions95Example: View {
  @Environment(\.workspaceWindow95) private var window

  var body: some View {
    HStack {
      Button95("Minimize") { window.minimize() }
      Button95("Close") { window.close() }
    }
  }
}

Essential behavior

ContextThe nearest WorkspaceWindow95 host supplies the actions.
No-opDefault environment actions safely do nothing outside a workspace window.
CapabilitiesOnly expose controls that match the window’s configured capabilities.

Related

Open the complete WorkspaceWindowActions95 API reference →