- Provides a subclass of UITextField that has suggestion from input
- Data suggestion are provided by users
- Has autocomplete input feature
- Optimized and light weight
- iOS 8.0+ / Mac OS X 10.9+
- Xcode 7.2+
You can use CocoaPods to install AutoCompleteTextField
by adding it to your Podfile
:
pod "AutoCompleteTextField"
Create a Cartfile
that lists the framework and run carthage bootstrap
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/AutoCompleteTextField.framework
to an iOS project.
github "nferocious76/AutoCompleteTextField"
- Download and drop
/Pod/Classes
folder in your project. - Congratulations!
// Subclass a TextField with 'AutoCompleteTextField'
let myTextField = AutoCompleteTextField(frame: CGRectMake(0, 0, 100, 30))
// Set dataSource, it can be setted from the XCode IB like TextFieldDelegate
myTextField.autoCompleteTextFieldDataSource = self
// Setting delimiter is optional. If setted, it will only look for suggestion if delimiter is found
myTextField.setDelimiter("@")
// 'autoCompleteTextFieldDelegate' acts like the default 'delegate' which 'delegate' is also accessible to the IB.
myTextField.autoCompleteTextFieldDelegate = YourDelegate
// Setting an autocompletion button with text field events
myTextField.showAutoCompleteButton(autoCompleteButtonViewMode: .WhileEditing)
// Then provide your data source to get the suggestion from inputs
func autoCompleteTextFieldDataSource(autoCompleteTextField: AutoCompleteTextField) -> [String] {
return AutoCompleteTextField.domainNames // ["gmail.com", "hotmail.com", "domain.net"]
}
// Initializing with datasource
let textFieldWithDelegateAndDataSource = AutoCompleteTextField(frame: CGRect(x: 20, y: 64, width: view.frame.width - 40, height: 40), autoCompleteTextFieldDataSource: self)
We would love for you to contribute to AutoCompleteTextField
. See the LICENSE file for more info.
Neil Francis Ramirez Hipona, [email protected]
This project was inpired by 'HTAutocompleteTextField' an Objc-C framework of the same feature.
AutoCompleteTextField is available under the MIT license. See the LICENSE file for more info.