{"id":18031722,"url":"https://github.com/dagronf/dsflabelledtextfield","last_synced_at":"2025-03-27T05:30:53.871Z","repository":{"id":63907297,"uuid":"295578453","full_name":"dagronf/DSFLabelledTextField","owner":"dagronf","description":"A simple macOS labelled text field using Swift","archived":false,"fork":false,"pushed_at":"2022-08-24T09:27:50.000Z","size":45,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T04:31:36.858Z","etag":null,"topics":["label","macos","nstextfield"],"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":"2020-09-15T01:12:48.000Z","updated_at":"2023-12-24T09:26:59.000Z","dependencies_parsed_at":"2022-11-29T13:21:14.756Z","dependency_job_id":null,"html_url":"https://github.com/dagronf/DSFLabelledTextField","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFLabelledTextField","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFLabelledTextField/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFLabelledTextField/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFLabelledTextField/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/DSFLabelledTextField/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791328,"owners_count":20672664,"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":["label","macos","nstextfield"],"created_at":"2024-10-30T10:10:33.843Z","updated_at":"2025-03-27T05:30:53.209Z","avatar_url":"https://github.com/dagronf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DSFLabelledTextField\n\n![](https://img.shields.io/github/v/tag/dagronf/DSFLabelledTextField) ![](https://img.shields.io/badge/macOS-10.11+-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/pod-compatible-informational)](https://cocoapods.org) [![](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)\n\nA simple macOS labelled text field using Swift.\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFLabelledTextField/s1.png)\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFLabelledTextField/s2.png)\n\n## Installation\n\n### Swift Package Manager\n\nAdd `https://github.com/dagronf/DSFLabelledTextField` to your project.\n\n### CocoaPods\n\nAdd the following to your `Podfiles` file\n\n```ruby\npod 'DSFLabelledTextField', :git =\u003e 'https://github.com/dagronf/DSFLabelledTextField'\n```\n\n### Direct\n\nAdd the swift files from the `Sources/DSFLabelledTextField` subfolder to your project\n\n## Usage\n\n1. Add a new NSTextField using Interface Builder, then change the class type to `DSFLabelledTextField`, or\n2. Programatically create one\n\n## Properties\n\n* `drawsRoundedEdges ` : Draw the control border using round rects\n* `drawsLabelBackground` : Draw a solid color behind the label\n* `label` : The text to display in the label\n* `labelForegroundColor` : The color of the label text\n* `labelBackgroundColor` : The color behind the label\n* `labelWidth` : The width of the label.  If set to -1, fits the label size to the label text.\n* `labelAlignment` : The alignment of the label. Useful if you have multiple label fields that you want to synchronise the width for.  Defaults to `NSTextAlignment.center`\n\n## Grouping fields\n\nThere are times where you might need to synchronise the width of the labels of a number of fields.  To do this, you can add the fields to a `DSFLabelledTextFieldGroup` instance and the field labels will size to fit the maximum width of all the labels in the group.\n\n### Example\n\n```swift\n\n@IBOutlet weak var redField: DSFLabelledTextField!\n@IBOutlet weak var greenField: DSFLabelledTextField!\n@IBOutlet weak var blueField: DSFLabelledTextField!\nlet colorGroup = DSFLabelledTextFieldGroup()\n\noverride func viewDidLoad() {\n   super.viewDidLoad()\n\n   /// Sync the widths of the red, green and blue labels\n   self.colorGroup.add(fields: redField, greenField, blueField)\n}\n\n```\n\n## More screenshots\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFLabelledTextField/s3.png)\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFLabelledTextField/s4.png)\n\n## History\n\n* `1.2.0`: Fixed issue with `@IBInspectable` not appearing in Interface Builder. Better 'enabled' visibility.\n* `1.1.0`: Added support for label grouping\n* `1.0.2`: Added label alignment (left, right, center etc)\n* `1.0.1`: Demonstrate dynamically create\n* `1.0.0`: Initial release\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2020 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%2Fdsflabelledtextfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fdsflabelledtextfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsflabelledtextfield/lists"}