{"id":15723956,"url":"https://github.com/tomdai/quicklookpreview","last_synced_at":"2025-08-16T15:08:22.674Z","repository":{"id":51359314,"uuid":"440690552","full_name":"tomdai/QuickLookPreview","owner":"tomdai","description":"QuickLook Preview for SwiftUI on Mac Catalyst","archived":false,"fork":false,"pushed_at":"2021-12-22T01:32:59.000Z","size":8,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-13T10:48:29.348Z","etag":null,"topics":["mac-catalyst","maccatalyst","quicklook","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomdai.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}},"created_at":"2021-12-22T00:47:33.000Z","updated_at":"2024-08-15T22:01:31.000Z","dependencies_parsed_at":"2022-09-14T01:33:01.806Z","dependency_job_id":null,"html_url":"https://github.com/tomdai/QuickLookPreview","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tomdai/QuickLookPreview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomdai%2FQuickLookPreview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomdai%2FQuickLookPreview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomdai%2FQuickLookPreview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomdai%2FQuickLookPreview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomdai","download_url":"https://codeload.github.com/tomdai/QuickLookPreview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomdai%2FQuickLookPreview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270728073,"owners_count":24635134,"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-16T02:00:11.002Z","response_time":91,"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":["mac-catalyst","maccatalyst","quicklook","swiftui"],"created_at":"2024-10-03T22:13:54.609Z","updated_at":"2025-08-16T15:08:22.645Z","avatar_url":"https://github.com/tomdai.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuickLook Preview for SwiftUI on Mac Catalyst\n\nAccording to the documentation for [`QLPreviewController`](https://developer.apple.com/documentation/quicklook/qlpreviewcontroller):\n\u003e For Mac apps built with Mac Catalyst, presenting a `QLPreviewController` displays the preview in a [`QLPreviewPanel`](https://developer.apple.com/documentation/quicklookui/qlpreviewpanel) and dims the previously active window.\n\nThis package provides a way to present the preview that doesn't dim the window.\n\n⚠️ This package is designed for and only tested on Mac Catalyst apps.\n\n![screen-recording](https://user-images.githubusercontent.com/5054148/147019774-dccba616-129b-45a2-bc40-0fa16acf3c10.gif)\n\n## Basic Usage\n\n```swift\n.quickLookPreview(_ items: Binding\u003c[QuickLookPreviewItem]\u003e, at index: Binding\u003cInt\u003e = Binding\u003cInt\u003e.constant(0))\n```\n\nAdd the line above to a view. When `$items` is populated with `QuickLookPreviewItem`s, the preview is presented.\n\n## Full Example\n\nNote that the example uses files named `1.png`, `2.png`, and `3.png` in the Xcode project.\n\n```swift\nimport SwiftUI\n\nstruct ContentView: View {\n    @State private var items: [QuickLookPreviewItem] = []\n    @State private var index = 0\n    \n    var body: some View {\n        ZStack {\n            Button(\"Present QuickLook Preview\") {\n                // Workaround needed because there's no way to know when the preview window is dismissed.\n                if self.items.isEmpty {\n                    fillItems()\n                } else {\n                    Task {\n                        self.items = []\n                        do { try await Task.sleep(nanoseconds: 0) } catch { fillItems() }\n                        fillItems()\n                    }\n                }\n            }\n        }\n        .quickLookPreview(self.$items, at: self.$index)\n    }\n    \n    func fillItems() {\n        self.items = [\n            QuickLookPreviewItem(url: Bundle.main.url(forResource: \"1\", withExtension: \"png\")!, title: \"No. 1\"),\n            QuickLookPreviewItem(url: Bundle.main.url(forResource: \"2\", withExtension: \"png\")!, title: \"No. 2\"),\n            QuickLookPreviewItem(url: Bundle.main.url(forResource: \"3\", withExtension: \"png\")!, title: \"No. 3\"),\n        ]\n        self.index = 2\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdai%2Fquicklookpreview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomdai%2Fquicklookpreview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdai%2Fquicklookpreview/lists"}