Skip to content

fmferrari/AutoCompleteTextField

 
 

Repository files navigation

AutoCompleteTextField

CI Status Version License Carthage compatible Platform

ezgif com-resize 1

Features

  • Provides a subclass of UITextField that has suggestion from input
  • Data suggestion are provided by users
  • Has autocomplete input feature
  • Optimized and light weight

Requirements

  • iOS 8.0+ / Mac OS X 10.9+
  • Xcode 7.2+

Installation

CocoaPods

You can use CocoaPods to install AutoCompleteTextField by adding it to your Podfile:

pod "AutoCompleteTextField"

Carthage

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"

Manually

  1. Download and drop /Pod/Classesfolder in your project.
  2. Congratulations!

Usage

// 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)

Contribute

We would love for you to contribute to AutoCompleteTextField. See the LICENSE file for more info.

Author

Neil Francis Ramirez Hipona, [email protected]

About

This project was inpired by 'HTAutocompleteTextField' an Objc-C framework of the same feature.

License

AutoCompleteTextField is available under the MIT license. See the LICENSE file for more info.

About

Auto complete with suggestion textfield

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 49.9%
  • Shell 33.7%
  • Ruby 14.4%
  • Objective-C 2.0%