Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericlewis/visionpane
Floating pane similar to iMessage on visionOS
https://github.com/ericlewis/visionpane
swiftui visionos
Last synced: 2 months ago
JSON representation
Floating pane similar to iMessage on visionOS
- Host: GitHub
- URL: https://github.com/ericlewis/visionpane
- Owner: ericlewis
- License: mit
- Created: 2024-02-24T00:34:25.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-09T20:06:37.000Z (10 months ago)
- Last Synced: 2024-04-15T02:47:33.158Z (8 months ago)
- Topics: swiftui, visionos
- Language: Swift
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# VisionPane
https://github.com/ericlewis/VisionPane/assets/674503/5cb4d4ef-5da8-4aaf-8345-62fe26e5b90f
## Code
```swift
import SwiftUI
import VisionPanestruct PaneView: View {
@Environment(\.dismissPane)
var dismissPane
var body: some View {
NavigationStack {
List {
Text("Item 1")
}
.toolbar {
Button("Dismiss", systemImage: "xmark") {
dismissPane()
}
}
.navigationTitle("Pane")
}
}
}struct NewWindowView: View {
@State
private var isPanePresented = false
var body: some View {
NavigationStack {
List {
Button("Toggle Pane") {
isPanePresented.toggle()
}
}
.navigationTitle("New Window")
}
.pane(isPresented: $isPanePresented) {
PaneView()
}
}
}struct ContentView: View {
@State
private var isPanePresented = false
@Environment(\.openWindow)
var openWindow
var body: some View {
NavigationStack {
List {
Button("Toggle Pane") {
isPanePresented.toggle()
}
Button("Open New Window") {
openWindow(id: "new-window")
}
}
.navigationTitle("Main")
}
.pane(isPresented: $isPanePresented) {
PaneView()
}
}
}@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup.Pane {
ContentView()
}
// Panes extend normal WindowGroup
WindowGroup.Pane(id: "new-window") {
ContentView()
}
}
}
```