{"id":20389627,"url":"https://github.com/c-villain/popoverpresenter","last_synced_at":"2025-06-19T21:32:08.866Z","repository":{"id":65149509,"uuid":"453691084","full_name":"c-villain/PopoverPresenter","owner":"c-villain","description":"Demo SwiftUI-project with custom alerts/popovers","archived":false,"fork":false,"pushed_at":"2022-12-30T14:40:46.000Z","size":702,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T00:24:21.283Z","etag":null,"topics":["popover","sheet","swift","swiftui","swiftui-example","swiftui-popover","swiftui-popup"],"latest_commit_sha":null,"homepage":"https://t.me/swiftui_dev","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/c-villain.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":"2022-01-30T13:43:02.000Z","updated_at":"2024-06-30T18:17:16.000Z","dependencies_parsed_at":"2023-01-02T15:22:50.085Z","dependency_job_id":null,"html_url":"https://github.com/c-villain/PopoverPresenter","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/c-villain/PopoverPresenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-villain%2FPopoverPresenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-villain%2FPopoverPresenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-villain%2FPopoverPresenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-villain%2FPopoverPresenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c-villain","download_url":"https://codeload.github.com/c-villain/PopoverPresenter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-villain%2FPopoverPresenter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260835237,"owners_count":23070256,"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","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":["popover","sheet","swift","swiftui","swiftui-example","swiftui-popover","swiftui-popup"],"created_at":"2024-11-15T03:18:50.269Z","updated_at":"2025-06-19T21:32:03.842Z","avatar_url":"https://github.com/c-villain.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PopoverPresenter\n\n[![Latest release](https://img.shields.io/github/v/release/c-villain/PopoverPresenter?color=brightgreen\u0026label=version)](https://github.com/c-villain/PopoverPresenter/releases/latest)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fc-villain%2FPopoverPresenter%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/c-villain/PopoverPresenter)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fc-villain%2FPopoverPresenter%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/c-villain/PopoverPresenter)\n[![](https://img.shields.io/badge/SPM-supported-DE5C43.svg?color=brightgreen)](https://swift.org/package-manager/)\n![](https://img.shields.io/github/license/c-villain/PopoverPresenter)\n\n[![contact: @lexkraev](https://img.shields.io/badge/contact-%40lexkraev-blue.svg?style=flat)](https://t.me/lexkraev)\n[![Telegram Group](https://img.shields.io/endpoint?color=brightgreen\u0026url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fswiftui_dev)](https://telegram.dog/swiftui_dev)\n\n👨🏻‍💻 Feel free to subscribe to channel **[SwiftUI dev](https://t.me/swiftui_dev)** in telegram.\n\nDemo project with tutorial how to customize alerts or popovers in SwiftUI based on [this article](https://medium.com/@ihamadfuad/swiftui-present-sheet-from-anywhere-using-environment-6104b2bd7d4e).\n\nBefore starting highly recommended to read [SwiftUI Custom Environment Values](https://useyourloaf.com/blog/swiftui-custom-environment-values/).\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"popover_demo.gif\" alt=\"demo\" height=\"600\" width=\"280\"\u003e\n\u003c/p\u003e\n\n## Installation\n\nTo use PopoverPresenter with a project targeting iOS 13, simply copy folder `Source` into your project.\n\n#### Swift Package Manager\n\nTo integrate PopoverPresenter into your project using SwiftPM add the following to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/c-villain/PopoverPresenter\", from: \"0.1.0\"),\n],\n```\n\n## Quick start\n\n1. Import library to your root-file view:\n```swift\nimport PopoverPresenter\n```\n2. Init instance in root view:\n```swift\n@StateObject var popoverPresenter = PopoverPresenter()\n```\n3. Add modifier to root-object view:\n```swift\n.environment(\\.popoverPresenterKey, popoverPresenter)\n.customPopover(item: $popoverPresenter.activePopover) { popover in\n    switch popover {\n    default:\n        popoverPresenter.currentPopover\n    }\n}\n```\n4. In child view create link to environment key:\n```swift\n@Environment(\\.popoverPresenterKey) var popoverPresenter\n```\n5. In child view create view with alert:\n```swift\npopoverPresenter.currentPopover = AnyView(Text(\"This is alert!\"))\npopoverPresenter.activePopover = .any\n```\n\nYou may look iOS example in package for guide steps above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-villain%2Fpopoverpresenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc-villain%2Fpopoverpresenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-villain%2Fpopoverpresenter/lists"}