{"id":18031743,"url":"https://github.com/dagronf/dsfcombobutton","last_synced_at":"2025-03-27T05:30:55.010Z","repository":{"id":50467391,"uuid":"501182918","full_name":"dagronf/DSFComboButton","owner":"dagronf","description":"A drop-in `NSComboButton` replacement with pre macOS 13 support.","archived":false,"fork":false,"pushed_at":"2023-01-16T20:32:36.000Z","size":99,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T04:31:39.671Z","etag":null,"topics":["appkit","macos","nscombobutton"],"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}},"created_at":"2022-06-08T09:27:01.000Z","updated_at":"2024-08-24T04:36:20.000Z","dependencies_parsed_at":"2023-02-10T06:15:29.477Z","dependency_job_id":null,"html_url":"https://github.com/dagronf/DSFComboButton","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFComboButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFComboButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFComboButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFComboButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/DSFComboButton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791333,"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","macos","nscombobutton"],"created_at":"2024-10-30T10:10:38.677Z","updated_at":"2025-03-27T05:30:54.372Z","avatar_url":"https://github.com/dagronf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSFComboButton\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/tag/dagronf/DSFComboButton\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/macOS-10.13+-red\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-lightgrey\" /\u003e\n    \u003ca href=\"https://swift.org/package-manager\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\nA drop-in [`NSComboButton`](https://developer.apple.com/documentation/appkit/nscombobutton) replacement control with pre macOS 13 support.\n\nFor when you want to adopt NSComboButton but have to maintain compatibility back to 10.13.\n\n## Features\n\nDSFComboButton attempts to match the NSComboButton control API as closely as possible.\nThe programmatic interface is almost identical, however (unfortunately) Interface Builder support in\na custom control is very limited so I've done as best I can.\n\n### Split style\n\n![Split style](./art/nscombobutton-split.jpg)\n\n* Click on the leading side of the button to perform a 'default' action\n* Click on the down arrow to present a menu\n\n### Unified style\n\n![Unified style](./art/nscombobutton-unified.jpg)\n\n* Click on the button to perform a 'default' action\n* Click and hold to present a menu\n\n## Styles\n\n| style      | description    |\n|------------|----------------|\n| `.split`   | A style that separates the button’s title and image from the menu indicator people use to activate the button. |\n| `.unified` | A style that unifies the button’s title and image with the menu indicator. |\n\n## Properties\n\n| property       | type    | description                                          |\n|----------------|---------|------------------------------------------------------|\n| `style`        | `DSFComboButton.Style`  | The control style to use             |\n| `title`        | `String`                | The text to display on the control   |\n| `image`        | `NSImage`               | The image to display on the control  |\n| `imageScaling` | `NSImageScaling`        | How the image scales                 |\n| `target`       | `AnyObject`             | The target for the button's action   |\n| `action`       | `Selector`              | The selector to call on the target   |\n| `controlSize`  | `NSControl.ControlSize` | The size of the control              |\n\n## Setting the popup menu\n\n### via code\n\nAssign an NSMenu instance to `.menu`\n\n```swift\nlet button = DSFComboButton()\nbutton.menu = NSMenu(...)\n```\n\n### via Interface Builder\n\n1. Drop an `NSMenu` instance into your XIB/Storyboard\n2. Ctrl-Drag from the `DSFComboButton` control on the storyboard to the menu, select `menu` outlet\n\n## Setting the button's target/action\n\n### via code\n\n```swift\nlet button = DSFComboButton()\nbutton.target = /*some controller*/\nbutton.action = #selector(buttonPressed(_:))\n```\n\n### via Interface Builder\n\nctrl-drag from the `DSFComboButton` control to the code.\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2023 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsfcombobutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fdsfcombobutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsfcombobutton/lists"}