From a7c6db72b754e59289bf0e4dd12f5c7cff5e5b3f Mon Sep 17 00:00:00 2001 From: Floriane Ennaji Date: Thu, 21 Jun 2018 17:31:19 -0400 Subject: [PATCH] Make highlight attributes the same size as the font --- SearchTextField/Classes/SearchTextField.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SearchTextField/Classes/SearchTextField.swift b/SearchTextField/Classes/SearchTextField.swift index 7045262..afd3e52 100755 --- a/SearchTextField/Classes/SearchTextField.swift +++ b/SearchTextField/Classes/SearchTextField.swift @@ -31,6 +31,7 @@ open class SearchTextField: UITextField { /// Set your custom visual theme, or just choose between pre-defined SearchTextFieldTheme.lightTheme() and SearchTextFieldTheme.darkTheme() themes open var theme = SearchTextFieldTheme.lightTheme() { didSet { + highlightAttributes = [.font: UIFont.boldSystemFont(ofSize: theme.font.pointSize)] tableView?.reloadData() if let placeholderColor = theme.placeholderColor { @@ -78,6 +79,7 @@ open class SearchTextField: UITextField { open var userStoppedTypingHandler: (() -> Void)? /// Set your custom set of attributes in order to highlight the string found in each item + /// Set it after setting the theme open var highlightAttributes: [NSAttributedStringKey: AnyObject] = [.font: UIFont.boldSystemFont(ofSize: 10)] /// Start showing the default loading indicator, useful for searches that take some time.