FUISearchTagsField
@MainActor
open class FUISearchTagsField : UIScrollView
extension FUISearchTagsField: UITextFieldDelegate
extension FUISearchTagsField: UIScrollViewDelegate
A UIScrollView shows a set of tags and a text field which allows user to input text.
Usage
Initialization
You can position tags field either setting the frame or constraints.
let tagsField = FUISearchTagsField()
Configuration
tagsField.tintColor = UIColor.preferredFioriColor(forStyle: .tintColorDark) // cursor color
tagsField.backgroundColor = UIColor.preferredFioriColor(forStyle: .primary9)
tagsField.contentInset = UIEdgeInsetsMake(9, 0, 9, 0)
tagsField.spaceBetweenTags = 5.0
tagsField.font = UIFont.systemFont(ofSize: 16)
tagsField.textColor = UIColor.preferredFioriColor(forStyle: .tintColorDark)
tagsField.fieldTextColor = UIColor.preferredFioriColor(forStyle: .tintColorDark)
tagsField.selectedColor = UIColor.preferredFioriColor(forStyle: .tintColorDark)
tagsField.selectedTextColor = UIColor.preferredFioriColor(forStyle: .primary1, background: .darkBackground)
tagsField.displayDelimiter = true
tagsField.delimiter = ","
tagsField.placeholder = "Search for Assignee"
tagsField.placeholderColor = UIColor.preferredFioriColor(forStyle: .primary3)
tagsField.numberOfLines = 2
Register a event handler
tagsField.onDidChangeText = { [weak self] (sender, text) in
// do something in response to text change.
}
Add or remove tags
tagsField.addTag("str")
tagsField.removeTag("str")
Theming
Supported class paths:
fdlFUITagsField {}
Supported TagsField attributes:
tint-color (Color) background-color (Color) content-insets (Box) font-color { -placeholder } (Color) font-name (FontName) font-style (UIFontTextStyle) font-size (Number) text-line-clamp (Integer) line-spacing (Float) tag-spacing (Float) tag-delimiter (String)
Supported Tag attributes:
tag-font-color { -selected } (Color) tag-background-color { -selected } (Color) tag-content-insets (Box)
Supported ImageView attributes:
search-icon-image (Image) search-icon-image-tint-color (Color)
-
The icon image of search image view.
Declaration
Swift
@MainActor open var searchIcon: UIImage? { get set } -
An image view shows before tags in tags field.
Declaration
Swift
@MainActor open var searchImageView: UIImageView -
Dedicated text field delegate.
Declaration
Swift
@MainActor open weak var textDelegate: UITextFieldDelegate? -
Background color for tag view in normal (non-selected) state.
Declaration
Swift
@MainActor open override var tintColor: UIColor! { get set } -
Text color for tag view in normal (non-selected) state.
Declaration
Swift
@MainActor open var textColor: UIColor? { get set } -
Background color for tag view in normal(non-selected) state.
Declaration
Swift
@MainActor open var normalBackgroundColor: UIColor? { get set } -
Background color for tag view in selected state.
Declaration
Swift
@MainActor open var selectedColor: UIColor? { get set } -
Text color for tag view in normal (selected) state.
Declaration
Swift
@MainActor open var selectedTextColor: UIColor? { get set } -
The delimiter to separate tags.
Declaration
Swift
@MainActor open var delimiter: String { get set } -
A boolean value indicates if delimiter is used.
Declaration
Swift
@MainActor open var isDelimiterVisible: Bool { get set } -
Max height of tags field.
Declaration
Swift
@MainActor open var maxHeight: CGFloat { get set } -
Max number of lines of tags can display in FUISearchTagsField before its contents become scrollable. Default value is 0, which means FUISearchTagsField always resize to fit all tags.
Declaration
Swift
@MainActor open var numberOfLines: Int { get set } -
Corner radius of tag view.
Declaration
Swift
@MainActor open var cornerRadius: CGFloat { get set } -
Border width of tag view.
Declaration
Swift
@MainActor open var borderWidth: CGFloat { get set } -
Border color of tags.
Declaration
Swift
@MainActor open var borderColor: UIColor? { get set } -
Text color of input text field.
Declaration
Swift
@MainActor open var fieldTextColor: UIColor? { get set } -
Placeholder text.
Declaration
Swift
@MainActor open var placeholder: String { get set } -
Text color of placeholder text.
Declaration
Swift
@MainActor open var placeholderColor: UIColor? { get set } -
A boolean value determines if placeholder text is always visible.
Declaration
Swift
@MainActor open var placeholderAlwaysVisible: Bool { get set } -
Font of text in both text field and tags.
Declaration
Swift
@MainActor open var font: UIFont? { get set } -
A boolean value determines if tags field is read only or not. In read only mode, tags are not selectable and you cannot input text in text field.
Declaration
Swift
@MainActor open var readOnly: Bool { get set } -
By default, the return key is used to create a tag in the field. You can change it, i.e., to use comma or space key instead.
Declaration
Swift
@MainActor open var acceptTagOption: FUISearchTagAcceptOption -
Content inset of tag view.
Declaration
Swift
@MainActor open override var contentInset: UIEdgeInsets { get set } -
Spacing between tags.
Declaration
Swift
@MainActor open var spaceBetweenTags: CGFloat { get set } -
Space between two lines.
Declaration
Swift
@MainActor open var spaceBetweenLines: CGFloat { get set } -
The layoutMargins to be applied to tag view. Default value is UIEdgeInsets.zero.
Declaration
Swift
@MainActor open var tagLayoutMargins: UIEdgeInsets { get set } -
A boolean value indicating if bounce animation hanppens on selection. Default value is true.
Declaration
Swift
@MainActor open var bounceOnSelection: Bool -
An array of tags in tags field.
Declaration
Swift
@MainActor open fileprivate(set) var tags: [FUISearchTag] { get }
-
Called when the text field should return.
Declaration
Swift
@MainActor open var onShouldAcceptTag: ((FUISearchTagsField) -> Bool)? -
Called when the text field text has changed. You should update your autocompleting UI based on the text supplied.
Declaration
Swift
@MainActor open var onDidChangeText: ((FUISearchTagsField, _ text: String?) -> Void)? -
Called when a tag has been added. You should use this opportunity to update your local list of selected items.
Declaration
Swift
@MainActor open var onDidAddTag: ((FUISearchTagsField, _ tag: FUISearchTag) -> Void)? -
Called when a tag has been removed. You should use this opportunity to update your local list of selected items.
Declaration
Swift
@MainActor open var onDidRemoveTag: ((FUISearchTagsField, _ tag: FUISearchTag) -> Void)? -
Called when a tag has been selected.
Declaration
Swift
@MainActor open var onDidSelectTagView: ((FUISearchTagsField, _ tag: FUISearchTagView) -> Void)? -
Called when a tag has been unselected.
Declaration
Swift
@MainActor open var onDidUnselectTagView: ((FUISearchTagsField, _ tag: FUISearchTagView) -> Void)? -
Called when the user attempts to press the Return key with text partially typed. @return A Tag for a match (typically the first item in the matching results), or nil if the text shouldn’t be accepted.
Declaration
Swift
@MainActor open var onVerifyTag: ((FUISearchTagsField, _ text: String) -> Bool)? -
Called when the view has updated its own height. If you are not using Autolayout, you should use this method to update the frames to make sure the tag view still fits.
Declaration
Swift
@MainActor open var onDidChangeHeightTo: ((FUISearchTagsField, _ height: CGFloat) -> Void)?
-
Undocumented
Declaration
Swift
@MainActor open var preferredMaxLayoutWidth: CGFloat { get } -
Undocumented
Declaration
Swift
@MainActor open override var intrinsicContentSize: CGSize { get } -
Undocumented
Declaration
Swift
@MainActor open override func willMove(toSuperview newSuperview: UIView?) -
Take the text inside of the field and make it a Tag.
Declaration
Swift
@MainActor open func acceptCurrentTextAsTag() -
A boolean value determines if input text field is editable.
Declaration
Swift
@MainActor open var isEditing: Bool { get } -
Notify tags field to begin editing.
Declaration
Swift
@MainActor open func beginEditing() -
Notify tags field to end editing.
Declaration
Swift
@MainActor open func endEditing()
-
Add tags into tags field.
Declaration
Swift
@MainActor open func addTags(_ tags: [String])Parameters
tagsInitiate tags with an array of strings.
-
Add tags into tags field.
Declaration
Swift
@MainActor open func addTags(_ tags: [FUISearchTag])Parameters
tagsInitiate tags with an array of
FUISearchTagstructs. -
Add a tag into tags field.
Declaration
Swift
@MainActor open func addTag(_ tag: String)Parameters
tagsInitiate a tag with a string.
-
Add a tag into tags field.
Declaration
Swift
@MainActor open func addTag(_ tag: FUISearchTag)Parameters
tagsInitiate a tag with a
FUISearchTagstruct. -
Remove a tag from tags field.
Declaration
Swift
@MainActor open func removeTag(_ tag: String)Parameters
tagThe tag with specific string to be removed.
-
Remove a tag from tags field.
Declaration
Swift
@MainActor open func removeTag(_ tag: FUISearchTag)Parameters
tagThe tag with specific
FUISearchTagstruct to be removed. -
Remove a tag at specific index from tags field.
Declaration
Swift
@MainActor open func removeTagAtIndex(_ index: Int)Parameters
tagThe index of the tag to be removed.
-
Remove all the tags from tags field.
Declaration
Swift
@MainActor open func removeTags() -
Generate a tag with text in text field then add it to tags field.
Declaration
Swift
@discardableResult @MainActor open func tokenizeTextFieldText() -> FUISearchTag?Return Value
The tag tokenized.
-
Called when text in text field changeds.
Declaration
Swift
@objc @MainActor open func onTextFieldDidChange(_ sender: AnyObject)Parameters
senderThe text field which invokes this method.
-
Select next tag.
Declaration
Swift
@MainActor open func selectNextTag() -
Select previous tag.
Declaration
Swift
@MainActor open func selectPrevTag() -
Select a tag view.
Declaration
Swift
@MainActor open func selectTagView(_ tagView: FUISearchTagView, animated: Bool = false)Parameters
tagViewThe tag view to select.
animatedIf the selection should be animated. Default value is false.
-
Unselect all the tags.
Declaration
Swift
@MainActor open func unselectAllTagViewsAnimated(_ animated: Bool = false)Parameters
animatedIf deselection should be animated. Default value if false.
-
The set of edges of the view, which should display a separator line.
Defaults to
.none.Important
Only top and bottom edges support separator lines. Options.leftand.rightwill be ignored.view.separators = .topDeclaration
Swift
@MainActor open var borders: UIRectEdge { get set }
-
The keyboard type to be used with a Quartz event source.
Declaration
Swift
@MainActor public var keyboardType: UIKeyboardType { get set } -
The visible title of the Return key.
Declaration
Swift
@MainActor public var returnKeyType: UIReturnKeyType { get set } -
The spell-checking style for the text object.
Declaration
Swift
@MainActor public var spellCheckingType: UITextSpellCheckingType { get set } -
The auto-capitalization style for the text object.
Declaration
Swift
@MainActor public var autocapitalizationType: UITextAutocapitalizationType { get set } -
The autocorrection style for the text object.
Declaration
Swift
@MainActor public var autocorrectionType: UITextAutocorrectionType { get set } -
A Boolean value indicating whether the Return key is automatically enabled when the user is entering text.
Declaration
Swift
@MainActor public var enablesReturnKeyAutomatically: Bool { get set } -
The text of input text field.
Declaration
Swift
@MainActor public var text: String? { get set } -
Undocumented
Declaration
Swift
@MainActor override open var inputAccessoryView: UIView? { get } -
The custom accessory view to display when the text field becomes the first responder.
Declaration
Swift
@objc @MainActor open var inputFieldAccessoryView: UIView? { get set }
-
Undocumented
Declaration
Swift
@MainActor public func textFieldDidBeginEditing(_ textField: UITextField) -
Undocumented
Declaration
Swift
@MainActor public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool -
Undocumented
Declaration
Swift
@MainActor public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool -
Undocumented
Declaration
Swift
@MainActor public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool -
Undocumented
Declaration
Swift
@MainActor public func textFieldDidChangeSelection(_ textField: UITextField) -
Undocumented
Declaration
Swift
@MainActor public func textFieldShouldClear(_ textField: UITextField) -> Bool