{"id":15066943,"url":"https://github.com/danielsaidi/gesturebutton","last_synced_at":"2025-10-12T07:36:42.258Z","repository":{"id":255500945,"uuid":"850952818","full_name":"danielsaidi/GestureButton","owner":"danielsaidi","description":"A SwiftUI button that can trigger actions for different gestures.","archived":false,"fork":false,"pushed_at":"2025-06-01T19:46:16.000Z","size":1469,"stargazers_count":70,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-02T00:31:34.356Z","etag":null,"topics":["button","gestures","ios","macos","swift","swiftui","visionos","watchos"],"latest_commit_sha":null,"homepage":"https://danielsaidi.com/opensource","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/danielsaidi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["danielsaidi"]}},"created_at":"2024-09-02T06:38:16.000Z","updated_at":"2025-09-01T08:34:15.000Z","dependencies_parsed_at":"2024-09-05T20:45:28.453Z","dependency_job_id":"318c790b-db1e-4df1-aed8-ed8a0257ae0c","html_url":"https://github.com/danielsaidi/GestureButton","commit_stats":null,"previous_names":["danielsaidi/gesturebutton"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/danielsaidi/GestureButton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FGestureButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FGestureButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FGestureButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FGestureButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielsaidi","download_url":"https://codeload.github.com/danielsaidi/GestureButton/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FGestureButton/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010667,"owners_count":26084784,"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-10-12T02:00:06.719Z","response_time":53,"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":["button","gestures","ios","macos","swift","swiftui","visionos","watchos"],"created_at":"2024-09-25T01:14:08.384Z","updated_at":"2025-10-12T07:36:42.252Z","avatar_url":"https://github.com/danielsaidi.png","language":"Swift","funding_links":["https://github.com/sponsors/danielsaidi"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Resources/Icon.png\" alt=\"Project Icon\" width=\"250\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/danielsaidi/GestureButton?color=%2300550\u0026sort=semver\" alt=\"Version\" title=\"Version\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/swift-6.0-orange.svg\" alt=\"Swift 6.0\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platform-SwiftUI-blue.svg\" alt=\"Swift UI\" title=\"Swift UI\" /\u003e\n    \u003ca href=\"https://danielsaidi.github.io/GestureButton\"\u003e\u003cimg src=\"https://img.shields.io/badge/documentation-web-blue.svg\" alt=\"Documentation\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/danielsaidi/GestureButton/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/danielsaidi/GestureButton\" alt=\"MIT License\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sponsors/danielsaidi\"\u003e\u003cimg src=\"https://img.shields.io/badge/sponsor-GitHub-red.svg\" alt=\"Sponsor my work\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# GestureButton\n\nGestureButton is a SwiftUI button that can trigger many different gesture-specific actions with a single gesture.\n\nYou can use a ``GestureButton`` just like a regular `Button`, and can define different actions for different gestures:\n\n```swift\nstruct ContentView: View {\n\n    @State private var isPressed = false\n    \n    var body: some View {\n        GestureButton(\n            isPressed: $isPressed,\n            pressAction: { print(\"Pressed\") },\n            releaseInsideAction: { print(\"Released Inside\") },\n            releaseOutsideAction: { print(\"Released Outside\") },\n            longPressAction: { print(\"Long Pressed\") },\n            doubleTapAction: { print(\"Double Tapped\") },\n            repeatAction: { print(\"Repeating Action\") },\n            dragStartAction: { value in print(\"Drag Started\") },\n            dragAction: { value in print(\"Drag \\(value)\") },\n            dragEndAction: { value in print(\"Drag Ended\") },\n            endAction: { print(\"Gesture Ended\") }\n        ) { isPressed in\n            Color.yellow // You can use any button content view.\n        }\n    }\n}\n```\n\nYou can pass in various delays and timeouts to change how the button behaves, e.g. the max time between two taps for the taps to count as a double-tap. You can use any `View` as the button label.\n\n\n\n## Installation\n\nGestureButton can be installed with the Swift Package Manager:\n\n```\nhttps://github.com/danielsaidi/GestureButton.git\n```\n\n\n## Support My Work\n\nYou can [become a sponsor][Sponsors] to help me dedicate more time on my various [open-source tools][OpenSource]. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.\n\n\n\n## Getting Started\n\nA ``GestureButton`` can be used just like a regular `Button`, as shown above, but needs some extra handling when used within a `ScrollView`.\n\n```swift\nstruct ContentView: View {\n\n    @StateObject private var scrollState = GestureButtonScrollState()\n    \n    var body: some View {\n        ScrollView(.horizontal) {\n            GestureButton(\n                scrollState: scrollState,\n                pressAction: { print(\"Pressed\") },\n                label: { isPressed in\n                    isPressed ? Color.yellow : Color.gray\n                    // You can use any button content view.\n                }\n            )\n        }\n        .scrollGestureState(scrollState)\n    }\n}\n```\n\nIn iOS 17 and earlier, you have to pass in a ``GestureButtonScrollState`` into the ``GestureButton`` initializer, for the button to not block the scroll gesture.\n\nIn iOS 18 and later, you must pass in a ``GestureButtonScrollState`` and apply it to the scroll view as well.\n\n\n\n## Documentation\n\nThe online [documentation][Documentation] has more information, articles, code examples, etc.\n\n\n\n## Demo Application\n\nThe `Demo` folder has a demo app that lets you explore the library and its components.\n\n\n\n## Contact\n\nFeel free to reach out if you have questions or if you want to contribute in any way:\n\n* Website: [danielsaidi.com][Website]\n* E-mail: [daniel.saidi@gmail.com][Email]\n* Bluesky: [@danielsaidi@bsky.social][Bluesky]\n* Mastodon: [@danielsaidi@mastodon.social][Mastodon]\n\n\n\n## License\n\nGestureButton is available under the MIT license. See the [LICENSE][License] file for more info.\n\n\n\n[Email]: mailto:daniel.saidi@gmail.com\n[Website]: https://danielsaidi.com\n[GitHub]: https://github.com/danielsaidi\n[OpenSource]: https://danielsaidi.com/opensource\n[Sponsors]: https://github.com/sponsors/danielsaidi\n\n[Bluesky]: https://bsky.app/profile/danielsaidi.bsky.social\n[Mastodon]: https://mastodon.social/@danielsaidi\n[Twitter]: https://twitter.com/danielsaidi\n\n[Documentation]: https://danielsaidi.github.io/GestureButton\n[Getting-Started]: https://danielsaidi.github.io/GestureButton/documentation/gesturebutton/getting-started\n[License]: https://github.com/danielsaidi/GestureButton/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsaidi%2Fgesturebutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielsaidi%2Fgesturebutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsaidi%2Fgesturebutton/lists"}