{"id":18031746,"url":"https://github.com/dagronf/dsftogglebutton","last_synced_at":"2025-03-27T05:30:55.466Z","repository":{"id":63907403,"uuid":"241053424","full_name":"dagronf/DSFToggleButton","owner":"dagronf","description":"Because sometimes all you want is a nice, big, very visible toggle button","archived":false,"fork":false,"pushed_at":"2024-07-20T07:59:25.000Z","size":117,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T04:31:40.185Z","etag":null,"topics":["appkit","button","cocoa","macos","objective-c","swift","toggle"],"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/dagronf.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":"2020-02-17T08:16:02.000Z","updated_at":"2025-01-07T17:46:44.000Z","dependencies_parsed_at":"2024-10-30T10:21:06.782Z","dependency_job_id":null,"html_url":"https://github.com/dagronf/DSFToggleButton","commit_stats":{"total_commits":40,"total_committers":1,"mean_commits":40.0,"dds":0.0,"last_synced_commit":"4d7b97d0412c6ce5371fe74686ffa9383360731b"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFToggleButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFToggleButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFToggleButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFToggleButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/DSFToggleButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791334,"owners_count":20672665,"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":["appkit","button","cocoa","macos","objective-c","swift","toggle"],"created_at":"2024-10-30T10:10:39.095Z","updated_at":"2025-03-27T05:30:54.906Z","avatar_url":"https://github.com/dagronf.png","language":"Swift","readme":"# DSFToggleButton\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFToggleButton/primary.png)\n\nA macOS NSSwitch-style toggle button scalable to any size. Supports Swift, SwiftUI and Objective-C.\n\n![](https://img.shields.io/github/v/tag/dagronf/DSFToggleButton) ![](https://img.shields.io/badge/macOS-10.13+-red) ![](https://img.shields.io/badge/Swift-5.0+-orange.svg)\n![](https://img.shields.io/badge/License-MIT-lightgrey) [![](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)\n\n# Why\n\nBecause sometimes all you want is a nice, big, very visible toggle button/checkbox.\n\n## Adding to your project\n\n### Swift Package Manager\n\nAdd `https://github.com/dagronf/DSFToggleButton` to your project.\n\n## Usage\n\nSince `DSFToggleButton` inherits from `NSButton`, its behaviour is the same as for a regular checkbox. You can programatically set the state or its enabled states just as you would for an `NSButton` for example, including manual bindings.\n\nThe control itself does not define its size, so you can make it as big or as small as you'd like. As all the drawing is scalable, the control will look great at any size you want.\n\n### Interface builder\n\nDrop in a new custom view into your canvas and set its class to `DSFToggleButton`.  \n\n## Configuration\n\n| Variable       | Type      | Description                                                                        |\n|----------------|-----------|------------------------------------------------------------------------------------|\n| `color`        | `NSColor` | The color of the button when the state is on, defaults to the off background color |\n| `showLabels`   | `Bool`    | Show labels (0 and 1) on the button to increase visual distinction between states  |\n| `animated`     | `Bool`    | Whether to animate state changes |\n| `highContrast` | `Bool`    | Remove any visual flourishes on the control |\n\n| Callback  | Description                                                                       |\n|-----------|-----------------------------------------------------------------------------------|\n| `stateChangeBlock` | A block-based callback mechanism (optional) which will be called whenever the button state changes |\n\n# Screenshots\n\n### Dark mode, green (no labels)\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFToggleButton/green_toggle.gif)\n\n### Dark mode, blue with labels\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFToggleButton/blue_toggle_labels.gif)\n\n### Light mode with labels, high contrast\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFToggleButton/gray_toggle_high_contrast.gif)\n\n### Interface Builder\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFToggleButton/interface_builder.png)\n\n# License\n\n```\nMIT License\n\nCopyright (c) 2024 Darren Ford\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsftogglebutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fdsftogglebutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsftogglebutton/lists"}