Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/divadretlaw/windowreader
📱 Access UIWindow/NSWindow in SwiftUI
https://github.com/divadretlaw/windowreader
nswindow swift swiftui uiwindow
Last synced: 3 months ago
JSON representation
📱 Access UIWindow/NSWindow in SwiftUI
- Host: GitHub
- URL: https://github.com/divadretlaw/windowreader
- Owner: divadretlaw
- License: mit
- Created: 2023-07-08T15:55:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-18T18:16:03.000Z (6 months ago)
- Last Synced: 2024-09-18T23:15:32.712Z (5 months ago)
- Topics: nswindow, swift, swiftui, uiwindow
- Language: Swift
- Homepage:
- Size: 29.3 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WindowReader
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FWindowSceneReader%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/divadretlaw/WindowReader)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FWindowSceneReader%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/divadretlaw/WindowReader)
Access the current `UIWindow` or `NSWindow` from any SwiftUI view.
## Usage
Read the current `UIWindow` or `NSWindow` with `WindowReader`
```swift
@main
struct MyView: View {
var body: some Scene {
WindowReader { window in
...
}
}
}
```On child views the `UIWindow` or `NSWindow` will be available in the `Environment`
### Environment
```swift
@Environment(\.window) var window
```## License
See [LICENSE](LICENSE)