{"id":15055328,"url":"https://github.com/infomaniak/swift-modal-presentation","last_synced_at":"2025-06-22T16:36:51.390Z","repository":{"id":227055439,"uuid":"770311712","full_name":"Infomaniak/swift-modal-presentation","owner":"Infomaniak","description":"A simple library to safely present sheets and other modals in SwiftUI.","archived":false,"fork":false,"pushed_at":"2024-08-08T07:11:00.000Z","size":11,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-13T05:17:31.503Z","etag":null,"topics":["ios","modal","router","sheet","swift","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Infomaniak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-03-11T10:35:06.000Z","updated_at":"2025-05-20T09:28:40.000Z","dependencies_parsed_at":"2025-02-16T11:32:32.528Z","dependency_job_id":"6f8ba59d-184d-47d4-9c20-847161aa47d3","html_url":"https://github.com/Infomaniak/swift-modal-presentation","commit_stats":null,"previous_names":["infomaniak/swift-modal-presentation"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Infomaniak/swift-modal-presentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infomaniak%2Fswift-modal-presentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infomaniak%2Fswift-modal-presentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infomaniak%2Fswift-modal-presentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infomaniak%2Fswift-modal-presentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Infomaniak","download_url":"https://codeload.github.com/Infomaniak/swift-modal-presentation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infomaniak%2Fswift-modal-presentation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261326225,"owners_count":23142039,"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":["ios","modal","router","sheet","swift","swiftui"],"created_at":"2024-09-24T21:40:54.863Z","updated_at":"2025-06-22T16:36:46.369Z","avatar_url":"https://github.com/Infomaniak.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftModalPresentation\n\nA simple library to safely present sheet and other modals in SwiftUI.  \nIt is meant to solve this kind of issues:  \n```\nCurrently, only presenting a single sheet is supported.\nThe next sheet will be presented when the currently presented sheet gets dismissed.\n```\n\n## Usage\n\nThe library is meant to be a drop-in replacement for presenting sheets with `@State` or `@Published`.  \nIf you try to present a new sheet while an already existing one is presented, it will automatically close the previous sheet before showing the new one.\n\nFor `@State` with `@ModalState`  \n```Swift\nstruct ContentView: View {\n    @ModalState private var isShowingSheet1 = false\n    @ModalState private var isShowingSheet2 = false\n    \n    var body: some View {\n        VStack {\n            Button(\"Show sheet 1\") {\n                isShowingSheet1 = true\n            }\n        }\n        .sheet(isPresented: $isShowingSheet1) {\n            VStack {\n                Text(\"Sheet 1\")\n                Button(\"Show sheet 2\") {\n                    isShowingSheet2 = true\n                }\n            }\n        }\n        .sheet(isPresented: $isShowingSheet2) {\n            Text(\"Sheet 2\")\n        }\n    }\n}\n```\n\nFor `@Published` in an `ObservableObject` with `@ModalPublished`  \n```Swift\nclass SomeObject: ObservableObject {\n    @ModalPublished var isShowingSheet1 = false\n    @ModalPublished var isShowingSheet2 = false\n}\n\nstruct ContentView: View {\n    @StateObject private var someObject = SomeObject()\n\n    var body: some View {\n        VStack {\n            Button(\"Show sheet 1\") {\n                someObject.isShowingSheet1 = true\n            }\n        }\n        .sheet(isPresented: $someObject.isShowingSheet1) {\n            VStack {\n                Text(\"Sheet 1\")\n                Button(\"Show sheet 2\") {\n                    someObject.isShowingSheet2 = true\n                }\n            }\n        }\n        .sheet(isPresented: $someObject.isShowingSheet2) {\n            Text(\"Sheet 2\")\n        }\n    }\n}\n```\n\nOptionally you can provide a context to the `ModalState/Published(context: \"SomeContextKey\")` to open nested sheets within the same view.  \n\n## Licence\n\nThis package is available under the permissive ApacheV2 licence for you to enjoy. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfomaniak%2Fswift-modal-presentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfomaniak%2Fswift-modal-presentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfomaniak%2Fswift-modal-presentation/lists"}