{"id":19233659,"url":"https://github.com/filipstefansson/autocompletefield","last_synced_at":"2025-04-05T04:12:53.396Z","repository":{"id":56902601,"uuid":"45784296","full_name":"filipstefansson/AutocompleteField","owner":"filipstefansson","description":"Subclass of UITextField that shows inline suggestions while typing.","archived":false,"fork":false,"pushed_at":"2020-10-13T08:59:57.000Z","size":438,"stargazers_count":664,"open_issues_count":3,"forks_count":40,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T03:08:54.895Z","etag":null,"topics":["autocomplete","input","suggestions","textfield","uitextfield"],"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/filipstefansson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-08T14:42:20.000Z","updated_at":"2025-03-08T17:25:31.000Z","dependencies_parsed_at":"2022-08-21T01:50:48.111Z","dependency_job_id":null,"html_url":"https://github.com/filipstefansson/AutocompleteField","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipstefansson%2FAutocompleteField","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipstefansson%2FAutocompleteField/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipstefansson%2FAutocompleteField/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filipstefansson%2FAutocompleteField/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filipstefansson","download_url":"https://codeload.github.com/filipstefansson/AutocompleteField/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"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":["autocomplete","input","suggestions","textfield","uitextfield"],"created_at":"2024-11-09T16:11:27.400Z","updated_at":"2025-04-05T04:12:53.376Z","avatar_url":"https://github.com/filipstefansson.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutocompleteField\n\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/AutocompleteField.svg)](https://img.shields.io/cocoapods/v/AutocompleteField.svg)\n[![Platform](https://img.shields.io/cocoapods/p/AutocompleteField.svg?style=flat)](https://AutocompleteField.github.io/AutocompleteField)\n\nSubclass of `UITextField` that shows inline suggestions while typing.\n\n- Plug and play replacement for `UITextField`.\n- [Delimiter support](#delimiter). Perfect when autocompleting email addresses.\n- Two suggestion modes (word and sentence, see [API](#api) below).\n- Works with custom fonts, borders etc.\n- Super lightweight and zero dependencies.\n\n---\n\n![AutocompleteField](/.github/example.gif?raw=true)\n\n# Requirements\n\n- iOS 10.0+\n- Swift 4.2+\n\n# Installation\n\n## CocoaPods\n\nAdd the following to your `Podfile`:\n\n```ruby\ntarget 'MyApp' do\n  pod 'AutocompleteField', '~\u003e 2.0'\nend\n```\n\n## Swift Package Manager\n\n- Select **File \u003e Swift Packages \u003e Add Package Dependency**.\n- Enter `https://github.com/filipstefansson/AutocompleteField.git` in the **Choose Package Repository** dialog.\n\nSee [Apple docs](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) for more information.\n\n## Manually\n\n- Copy `/Sources/AutocompleteField.swift` to your project. There are no other dependencies.\n\n# Usage\n\nYou use this textfield in the same way as the regular `UITextField`, through Storyboards or programmatically.\n\n## Basic\n\n```swift\nimport AutocompleteField\n\n...\n\nlet textfield = AutocompleteField(frame: CGRect(x: 20, y: 20, width: 200, height: 40))\ntextfield.placeholder = \"Name\"\n\ntextfield.suggestions = [\n  \"George Washington\",\n  \"Thomas Jefferson\",\n  \"John Adams\",\n  \"Theodore Roosevelt\",\n  \"John F. Kennedy\",\n  \"George W. Bush\",\n]\n\nself.view.addSubview(textfield)\n```\n\n## Delimiter\n\nThe delimiter can be used to only suggest an autocompletion after a specific character is found in the string. In this example we look for the `@` character, and then provide suggestions for email providers.\n\n```swift\nimport AutocompleteField\n\n...\n\n// email textfield autocompleting email providers\nlet textfield = AutocompleteField(frame: CGRect(x: 20, y: 20, width: 200, height: 40))\ntextfield.placeholder = \"Email\"\ntextfield.keyboardType = .emailAddress\n\ntextfield.suggestions = [\n  \"gmail.com\",\n  \"icloud.com\",\n  \"outlook.com\",\n]\n\n// add the delimiter\ntextfield.delimiter = \"@\"\n\nself.view.addSubview(textfield)\n```\n\n# API\n\n| Property            | Type             | Description                                                                                                                                                                     |\n| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `suggestionColor`   | `UIColor`        | The color of the suggestion. Defaults to the default placeholder color.                                                                                                         |\n| `suggestion`        | `String`         | The current suggestion shown. Read only.                                                                                                                                        |\n| `suggestions`       | `[String]`       | Array of suggestions.                                                                                                                                                           |\n| `suggestionType`    | `SuggestionType` | The type of suggestion that should be used. `.Word` will only hint the the next word in the suggestion and `.Sentence` will show the whole suggestion. Defaults to `.Sentence`. |\n| `pixelCorrections`  | `CGPoint`        | Move the suggestion label up/down left/right. Use this to correct any differences if the suggestion doesn't match the input value for some reason.                              |\n| `horizontalPadding` | `CGFloat`        | Add padding to your textfield. Automatically set when using a `borderStyle` that has padding.                                                                                   |\n| `delimiter`         | `String`         | Add a delimiter to only show a suggestion if there's more than one occurance of the delimiter. Perfect for autocompleting email providers.                                      |\n\n# Demo\n\nCheck out the [example project](/Example).\n\n# License\n\n`AutocompleteField` is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipstefansson%2Fautocompletefield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilipstefansson%2Fautocompletefield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilipstefansson%2Fautocompletefield/lists"}