diff --git a/SearchTextField/Classes/SearchTextField.swift b/SearchTextField/Classes/SearchTextField.swift index 7045262..0368ce7 100755 --- a/SearchTextField/Classes/SearchTextField.swift +++ b/SearchTextField/Classes/SearchTextField.swift @@ -80,6 +80,9 @@ open class SearchTextField: UITextField { /// Set your custom set of attributes in order to highlight the string found in each item open var highlightAttributes: [NSAttributedStringKey: AnyObject] = [.font: UIFont.boldSystemFont(ofSize: 10)] + /// Disable highlight attributes + open var forceNoHighlightAttributes = false + /// Start showing the default loading indicator, useful for searches that take some time. open func showLoadingIndicator() { self.rightViewMode = .always @@ -439,10 +442,12 @@ open class SearchTextField: UITextField { item.attributedTitle = NSMutableAttributedString(string: item.title) item.attributedSubtitle = NSMutableAttributedString(string: (item.subtitle != nil ? item.subtitle! : "")) - item.attributedTitle!.setAttributes(highlightAttributes, range: titleFilterRange) - - if subtitleFilterRange.location != NSNotFound { - item.attributedSubtitle!.setAttributes(highlightAttributesForSubtitle(), range: subtitleFilterRange) + if !forceNoHighlightAttributes { + item.attributedTitle!.setAttributes(highlightAttributes, range: titleFilterRange) + + if subtitleFilterRange.location != NSNotFound { + item.attributedSubtitle!.setAttributes(highlightAttributesForSubtitle(), range: subtitleFilterRange) + } } filteredResults.append(item)