{"id":20245987,"url":"https://github.com/cooloneofficial/nativepartialsheet","last_synced_at":"2025-04-10T21:12:34.084Z","repository":{"id":59640081,"uuid":"538265152","full_name":"CoolONEOfficial/NativePartialSheet","owner":"CoolONEOfficial","description":"🔥 Native partial customizable SwiftUI sheets from iOS 15.0 ","archived":false,"fork":false,"pushed_at":"2024-03-20T22:20:24.000Z","size":27,"stargazers_count":119,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T21:12:33.206Z","etag":null,"topics":["modals","sheet","swiftui"],"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/CoolONEOfficial.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":"2022-09-18T23:11:53.000Z","updated_at":"2024-11-10T09:22:57.000Z","dependencies_parsed_at":"2024-11-14T09:40:13.947Z","dependency_job_id":null,"html_url":"https://github.com/CoolONEOfficial/NativePartialSheet","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoolONEOfficial%2FNativePartialSheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoolONEOfficial%2FNativePartialSheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoolONEOfficial%2FNativePartialSheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoolONEOfficial%2FNativePartialSheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoolONEOfficial","download_url":"https://codeload.github.com/CoolONEOfficial/NativePartialSheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248298316,"owners_count":21080320,"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":["modals","sheet","swiftui"],"created_at":"2024-11-14T09:25:55.219Z","updated_at":"2025-04-10T21:12:34.057Z","avatar_url":"https://github.com/CoolONEOfficial.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NativePartialSheet\n\nMain feature of this library - native support of ***custom*** SwiftUI's presentationDetents from ***iOS 15.0*** 🔥\n\n## Screenshots\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/18753760/190933073-5185fca7-1962-447c-9424-0da7f8ede7d3.png\" width=\"250\" /\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/18753760/190933093-180f954d-c6b3-49cd-88b6-9c9c5f630cb0.png\" width=\"250\" /\u003e \n  \u003cimg src=\"https://user-images.githubusercontent.com/18753760/190933098-07d6abc7-c868-478e-96f9-30d3a7ecbb1f.png\" width=\"250\" /\u003e\n\u003c/p\u003e\n\n## Simple examples\n\n### Classic isPresented way\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nstruct ContentView: View {\n    @State var isPresented = false\n\n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                isPresented = true\n            }\n            .nativePartialSheet(isPresented: $isPresented) {\n                Text(\"Sheet content\")\n            }\n            .presentationDetents([ .large, .medium ])\n    }\n}\n```\n\n### Optional detent way\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nstruct ContentView: View {\n    @State var detent: Detent?\n    \n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                detent = .medium\n            }\n            .nativePartialSheet(selectedDetent: $detent) { detent in\n                switch detent {\n                case .medium:\n                    Text(\"Medium\")\n                case .large:\n                    Text(\"Large\")\n                default:\n                    EmptyView()\n                }\n            }\n            .presentationDetents([ .large, .medium ])\n    }\n}\n```\n\n## Advanced examples\n\n### Sheet configuration\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nstruct ContentView: View {\n    @State var isPresented = false\n    @State var detent: Detent = .medium\n\n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                isPresented = true\n            }\n            .nativePartialSheet(isPresented: $isPresented) {\n                Text(\"Sheet content\")\n            }\n            .presentationDetents([ .medium, .large ], selection: $detent)\n            .cornerRadius(32)\n            .presentationDragIndicator(.visible)\n            .edgeAttachedInCompactHeight(true)\n            .scrollingExpandsWhenScrolledToEdge(true)\n            .widthFollowsPreferredContentSizeWhenEdgeAttached(true)\n            .largestUndimmedDetent(.medium)\n            .interactiveDismissDisabled(true, onWillDismiss: onWillDismiss, onDidDismiss: onDidDismiss)\n    }\n    \n    func onDidDismiss() {\n        debugPrint(\"DID\")\n    }\n    \n    func onWillDismiss() {\n        debugPrint(\"WILL\")\n    }\n}\n```\n\n### Use with item\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nstruct MyItem: Identifiable {\n    var content: String\n    var id: String { content }\n}\n\nstruct ContentView: View {\n    @State var item: MyItem?\n\n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                item = .init(content: \"Test content\")\n            }\n            .nativePartialSheet(item: $item) { item in\n                VStack {\n                    Button(\"recreate\") {\n                        self.item = .init(content: \"Recreated content\")\n                    }\n                    Button(\"change\") {\n                        self.item?.content = \"Changed content\"\n                    }\n                    Text(item.content)\n                }\n            }\n            .presentationDetents([ .large, .medium ])\n    }\n}\n```\n\n### Custom static detents\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nextension Detent {\n    static let customSmall: Detent = .height(100)\n}\n\nstruct ContentView: View {\n    @State var detent: Detent?\n    \n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                detent = .customSmall\n            }\n            .nativePartialSheet(selectedDetent: $detent) { detent in\n                switch detent {\n                case .medium:\n                    Text(\"Medium\")\n                case .large:\n                    Text(\"Large\")\n                case .customSmall:\n                    Text(\"Custom small\")\n                default:\n                    EmptyView()\n                }\n            }\n            .presentationDetents([ .large, .medium, .customSmall ])\n    }\n}\n```\n\n### Custom dynamic detents\n\n```swift\nimport SwiftUI\nimport NativePartialSheet\n\nstruct ContentView: View {\n    @State var detent: Detent?\n    @State var detents: Set\u003cDetent\u003e = [ .large, .medium ]\n    \n    var body: some View {\n        Text(\"Open sheet\")\n            .onTapGesture {\n                let dynamic = Detent.height(123)\n                detents.insert(dynamic)\n                detent = dynamic\n            }\n            .nativePartialSheet(selectedDetent: $detent) { detent in\n                switch detent {\n                case .height(_):\n                    Text(\"Dynamic\")\n                case .medium:\n                    Text(\"Medium\")\n                case .large:\n                    Text(\"Large\")\n                }\n            }\n            .presentationDetents(detents)\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooloneofficial%2Fnativepartialsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcooloneofficial%2Fnativepartialsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcooloneofficial%2Fnativepartialsheet/lists"}