{"id":18031731,"url":"https://github.com/dagronf/dsffloatlabelledtextcontrol","last_synced_at":"2025-03-27T05:30:54.996Z","repository":{"id":63907291,"uuid":"169137454","full_name":"dagronf/DSFFloatLabelledTextControl","owner":"dagronf","description":"A macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern.","archived":false,"fork":false,"pushed_at":"2023-03-15T01:25:29.000Z","size":103,"stargazers_count":26,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T04:31:36.855Z","etag":null,"topics":["cocoa","cocoapod","float-label-pattern","nssecuretextfield","nstextfield","objective-c","swift","ui-components"],"latest_commit_sha":null,"homepage":"","language":"Python","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":"2019-02-04T19:42:09.000Z","updated_at":"2023-12-05T05:52:50.000Z","dependencies_parsed_at":"2022-11-28T20:15:36.424Z","dependency_job_id":null,"html_url":"https://github.com/dagronf/DSFFloatLabelledTextControl","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFloatLabelledTextControl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFloatLabelledTextControl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFloatLabelledTextControl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagronf%2FDSFFloatLabelledTextControl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagronf","download_url":"https://codeload.github.com/dagronf/DSFFloatLabelledTextControl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791332,"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":["cocoa","cocoapod","float-label-pattern","nssecuretextfield","nstextfield","objective-c","swift","ui-components"],"created_at":"2024-10-30T10:10:36.048Z","updated_at":"2025-03-27T05:30:54.029Z","avatar_url":"https://github.com/dagronf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# macOS Float Label Pattern Text Field\n\nA macOS Cocoa single-line NSTextField/NSSecureTextField that implements the Float Label Pattern. \nYou can read about the float pattern [here](http://mds.is/float-label-pattern/). \n\n![](https://img.shields.io/github/v/tag/dagronf/DSFFloatLabelledTextControl) ![](https://img.shields.io/badge/macOS-10.11+-red) ![](https://img.shields.io/badge/Swift-5.4-orange.svg) ![](https://img.shields.io/badge/ObjectiveC-2.0-purple.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\n## Screenshot\n\n![](https://github.com/dagronf/dagronf.github.io/raw/master/art/projects/DSFFloatingLabel/floating_label_text_field.gif)\n\n## Why?\n\nI was curious as to whether this pattern would work for a Mac program.  I wanted this to be a basic drop-in for an existing text field, using the NSTextField `placeholderString` value as the floating label title.\n\n## Installation\n\n### Swift Package Manager\n\nAdd `https://github.com/dagronf/DSFFloatLabelledTextControl` to your project.\n\n### Cocoapods\n\nAdd `pod 'DSFFloatLabelledTextControl', :git =\u003e 'https://github.com/dagronf/DSFFloatLabelledTextControl'` to your podfile.\n\n## Usage\n\n### Interface builder\n\n* Drop in a new Text Field into your canvas and set its class to `DSFFloatLabelledTextField` or\n `DSFFloatLabelledSecureTextControl` depending on whether you need a secure field\n* Set the size and style of your primary font as you would a regular text field\n* Set the size of the secondary font via the attributes inspector for the control\n\n### Dynamically\n\n```swift\nlet field = DSFFloatLabelledTextField()\nfield.placeholderString = \"Dynamic Created\"\nfield.font = NSFont.systemFont(ofSize: 16)\nparentView.addSubview(field)\n\t\t\n/// Setup autolayout constraints etc.\n```\n\n## Custom Properties\n\nThese controls inherit from `NSTextField`, so all `NSTextField` functionalities (like cocoa binding and Interface Builder settings) are available.  If you can use an NSTextField, you can use this control.\n\n* `placeholderTextSize` - the size of the text used in the floating label (in pt)\n* `placeholderSpacing` - the distance between the text field text and the floating label (in px)\n\n## Delegate Handling\n\nYou can specify a delegate (`floatLabelDelegate`), either programatically or via Interface Builder, to receive additional information regarding the actions of the control.\n\n## Screenshot\n\n\u003cimg src=\"https://github.com/dagronf/dagronf.github.io/blob/master/art/projects/DSFFloatingLabel/light-mode-secure-field.png?raw=true\" alt=\"drawing\" width=\"265\"/\u003e\n\n## Credits\n\n* Pattern devised by [Matt D. Smith](http://mds.is/matt/)\n* Read about the pattern [here](http://mds.is/float-label-pattern/)\n* [UITextField implementation](https://github.com/jverdi/JVFloatLabeledTextField)\n\n## Versions\n\n* `2.0.0`: Moved secure text field into separate class (fixing security warnings in modern Xcode) \n* `1.8.0`: Added secure text field support, delegate support\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%2Fdsffloatlabelledtextcontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagronf%2Fdsffloatlabelledtextcontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagronf%2Fdsffloatlabelledtextcontrol/lists"}