{"id":15055331,"url":"https://github.com/divadretlaw/windowkit","last_synced_at":"2025-08-01T15:03:52.636Z","repository":{"id":200280174,"uuid":"705179186","full_name":"divadretlaw/WindowKit","owner":"divadretlaw","description":"🪟 Easily present SwiftUI views in their own UIWindow","archived":false,"fork":false,"pushed_at":"2025-06-22T22:14:56.000Z","size":113,"stargazers_count":39,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-25T06:37:39.253Z","etag":null,"topics":["swift","swiftui","uiwindow","window"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divadretlaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-15T09:16:33.000Z","updated_at":"2025-06-23T00:46:14.000Z","dependencies_parsed_at":"2023-10-16T11:39:45.182Z","dependency_job_id":"339f2e2a-acc8-4bb0-ae8d-8d7fa6e7a9bd","html_url":"https://github.com/divadretlaw/WindowKit","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":"0.050000000000000044","last_synced_commit":"d9a7d0fffaf1ddf390f88f5a0d1cd970df8d0309"},"previous_names":["divadretlaw/windowkit"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/divadretlaw/WindowKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divadretlaw%2FWindowKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divadretlaw%2FWindowKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divadretlaw%2FWindowKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divadretlaw%2FWindowKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divadretlaw","download_url":"https://codeload.github.com/divadretlaw/WindowKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divadretlaw%2FWindowKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268248335,"owners_count":24219548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swift","swiftui","uiwindow","window"],"created_at":"2024-09-24T21:40:56.641Z","updated_at":"2025-08-01T15:03:52.612Z","avatar_url":"https://github.com/divadretlaw.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WindowKit\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FWindowSceneReader%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/divadretlaw/WindowKit)\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdivadretlaw%2FWindowSceneReader%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/divadretlaw/WindowKit)\n\nHandle `UIWindow` \u0026 `UIWindowScene` within SwifUI and present SwiftUI Views in their own window.\n\n## Usage\n\n### `windowCover(isPresented:content:)`\n\n![Static Badge](https://img.shields.io/badge/Platform_Compability-iOS%20%7C%20visionOS%20%7C%20tvOS-orange?logo=swift\u0026labelColor=white)\n\nPresent a modal view within it's own `UIWindow` from any SwiftUI view.\n\nUsage is similar to `fullscreenCover(isPresented:content:)`\n\n```swift\n.windowCover(isPresented: $isPresented) {\n    MyWindowCover()\n}\n```\n\nYou can also configure the window presentation\n\n```swift\n.windowCover(isPresented: $isPresented) {\n    MyWindowCover()\n} configure { configuration in\n    // Customize the window cover presentation\n} \n```\n\n#### Environment\n\nIn order to dismiss the window cover, use the `dismissWindowCover` from the environment\n\n```swift\n@Environment(\\.dismissWindowCover) var dismiss\n```\n\nIn case the current view is not presented within a window cover the `dismissWindowCover` action will do nothing.\n\n### `windowOverlay(content:)`\n\n![Static Badge](https://img.shields.io/badge/Platform_Compability-iOS%20%7C%20visionOS%20%7C%20tvOS-orange?logo=swift\u0026labelColor=white)\n\nPresent a modal view within it's own `UIWindow` from any SwiftUI view.\n\nUsage is similar to `overlay(content:)`\n\n```swift\n.windowOverlay {\n    MyWindowOverlay()\n}\n```\n\nYou can also configure the window presentation\n\n```swift\n.windowOverlay {\n    MyWindowOverlay()\n} configure { configuration in\n    // Customize the window overlay presentation\n} \n```\n\n### [`WindowReader`](https://github.com/divadretlaw/WindowReader)\n\n![Static Badge](https://img.shields.io/badge/Platform_Compability-iOS%20%7C%20macOS%20%7C%20visionOS%20%7C%20tvOS-orange?logo=swift\u0026labelColor=white)\n\nRead the current `UIWindow` or `NSWindow` with `WindowReader`\n\n```swift\n@main\nstruct MyView: View {\n    var body: some Scene {\n        WindowReader { window in\n            ...\n        }\n    }\n}\n```\n\nOn child views the `UIWindow` or `NSWindow` will be available in the `Environment`\n\n#### Environment\n\n```swift\n@Environment(\\.window) var window\n```\n\n### [`WindowSceneReader`](https://github.com/divadretlaw/WindowSceneReader)\n\n![Static Badge](https://img.shields.io/badge/Platform_Compability-iOS%20%7C%20visionOS%20%7C%20tvOS-orange?logo=swift\u0026labelColor=white)\n#### SwiftUI Lifecycle\n\nRead the current `UIWindowScene` with `WindowSceneReader`\n\n```swift\n@main\nstruct MyApp: App {\n    var body: some Scene {\n        WindowGroup {\n            WindowSceneReader { windowScene in\n                ContentView()\n            }\n        }\n    }\n}\n```\n\nalternatively, just add `windowScene()` if you only need the window scene on child views.\n\n```swift\n@main\nstruct MyApp: App {\n    var body: some Scene {\n        WindowGroup {\n            ContentView()\n                .windowScene()\n        }\n    }\n}\n```\n\nOn child views the `UIWindowScene` will be available in the `Environment`\n\n#### UIKit Lifecycle\n\n```swift\nclass SceneDelegate: UIResponder, UIWindowSceneDelegate {\n    var window: UIWindow?\n    \n    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {\n        if let windowScene = scene as? UIWindowScene {\n            let rootView = ContentView()\n                .windowScene(windowScene)\n            \n            let window = UIWindow(windowScene: windowScene)\n            window.rootViewController = UIHostingController(rootView: rootView)\n            self.window = window\n            window.makeKeyAndVisible()\n    }\n}\n```\n\n#### Environment\n\n```swift\n@Environment(\\.windowScene) var windowScene\n```\n\nThe `@Environment(\\.windowScene) var windowScene` defaults to the first connected `UIWindowScene` or `nil` if no `UIWindowScene` is connected.\n\n## License\n\nSee [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivadretlaw%2Fwindowkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivadretlaw%2Fwindowkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivadretlaw%2Fwindowkit/lists"}