Latest 0.0.1
Homepage https://github.com/uxmstudio/UXMTokenField
License MIT
Platforms ios 8.0, requires ARC
Authors

UXM Token Field

Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

UXMTokenField is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "UXMTokenField"

Usage

UXMTokenField provides two protocols: UXMTokenFieldDelegate and UXMTokenFieldDataSource. The delegate is optional and will allow you to react to events inside of the text field. The data source on the other hand is required to provide necessary information for how the field functions.

UXMTokenFieldDelegate

This protocol notifies you when things happen in the token field that you might want to know about.

  • tokenField:didEnterText: is called when a user hits the return key on the input field.
  • tokenField:didDeleteTokenAtIndex: is called when a user deletes a token at a particular index.
  • tokenField:didChangeText: is called when a user changes the text in the input field.
  • tokenField:didChangeContentHeight: is called when the height of the field is modified.
  • tokenFieldDidBeginEditing: is called when the input field becomes first responder.

UXMTokenFieldDataSource

This protocol allows you to provide info about what you want to present in the token field.

  • tokenField:titleForTokenAtIndex: to specify what the title for the token at a particular index should be.
  • tokenField:autocompleteValuesFor text: allows you to tell the token field what autocomplete values to display at any given time.
  • numberOfTokensInTokenField: to specify how many tokens you have.
  • tokenFieldCollapsedText: to specify what you want the token field to say in the collapsed state.

Additionally the token field has a number of other properties you can modify to customize it to your liking.


/// Public
var delegate:UXMTokenFieldDelegate
var dataSource:UXMTokenFieldDataSource

var maxHeight:CGFloat
var verticalInset:CGFloat
var horizontalInset:CGFloat
var tokenPadding:CGFloat
var minInputWidth:CGFloat

var inputTextFieldKeyboardType:UIKeyboardType
var inputTextFieldKeyboardAppearance:UIKeyboardAppearance

var autocorrectionType:UITextAutocorrectionType
var autocapitalizationType:UITextAutocapitalizationType
var inputTextFieldAccessoryView:UIView

var delimiters:[String]
var tokens:[UXMToken]
var tokenSeperator:String
var placeholderText:String
var placeholderAttributedText:NSAttributedString
var colorScheme:UIColor
var hideKeyboardOnAutocomplete:Bool

Tips

  • If the autocomplete table is not appearing, this could be because the parent elements clip to bound settings are preventing it from being seen.
  • Autocomplete cells allow for either an array of strings, or an array of UXMAutocompleteItem‘s to be passed in. While a string will display as just one line of text, an autocomplete item allows for a subtitle as well.

Author

Chris Anderson:

License

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

Latest podspec

{
    "name": "UXMTokenField",
    "version": "0.0.1",
    "summary": "An easy-to-use token field with autocompletion",
    "description": "Incorporate a token field for emails, user look up, etc easily without having to recreate autocompletion.",
    "homepage": "https://github.com/uxmstudio/UXMTokenField",
    "license": "MIT",
    "authors": {
        "Chris Anderson": "[email protected]"
    },
    "source": {
        "git": "https://github.com/uxmstudio/UXMTokenField.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "UXMTokenField/Classes/**/*",
    "resource_bundles": {
        "UXMTokenField": [
            "UXMTokenField/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This