TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | May 2017 |
SwiftSwift Version | 3.1 |
SPMSupports SPM | ✗ |
Maintained by Matija Kruljac.
UITFCompletion makes it easy to complete words or make tags of participants of group conversation for instance in UITextField like Facebook Messenger.
To run the example project, clone the repo, and run pod install
from the Example directory first.
This gif shows example application in which collection and tag character can be edited.
UITFCompletion is available through CocoaPods. To install it, simply add the following lines to your Podfile:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod "UITFCompletion"
end
Using UITFCompletion
is very easy. Just call init
method and pass all required parameters.
Collection must be an array of String
s.TagCharacter
can be set when collection
is set with setup(collection: collection, withTagCharacter: String)
method.
// initial setup for example
private var data = ["shark", "lion", "giraffe", "elephant", "orangutan", "dog", "cat"]
private var tagCharacter = "@" // or "##"
guard let parentView = userInputTextField.superview else { return }
// required parameters for initialization are UITextField for input and its parent view
// in init collection can be passed or not - if passed tagCharacter is "@" as default
uitfCompletionHandler = UITFCompletionHandler.init(with: userInputTextField, withParentView: parentView)
// setup collection and tagCharacter
// if setup(tagCharacter: String) is not called, tagCharacter will be "@" as default
uitfCompletionHandler.setup(collection: data)
uitfCompletionHandler.setup(tagCharacter: tagCharacter)
// colors for completion holder text and chosen tag can be changed - default color is .blue
uitfCompletionHandler.changeCompletionText(color: UIColor(red: 0, green: 0.6275, blue: 0.2275, alpha: 1.0))
uitfCompletionHandler.changeChosenTag(color: UIColor(red: 0.8863, green: 0, blue: 0.0588, alpha: 1.0))
Matija Kruljac, [email protected]
UITFCompletion is available under the MIT license. See the LICENSE file for more info.