Skip to content

Commit a7c6db7

Browse files
Make highlight attributes the same size as the font
1 parent 97cb555 commit a7c6db7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

SearchTextField/Classes/SearchTextField.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ open class SearchTextField: UITextField {
3131
/// Set your custom visual theme, or just choose between pre-defined SearchTextFieldTheme.lightTheme() and SearchTextFieldTheme.darkTheme() themes
3232
open var theme = SearchTextFieldTheme.lightTheme() {
3333
didSet {
34+
highlightAttributes = [.font: UIFont.boldSystemFont(ofSize: theme.font.pointSize)]
3435
tableView?.reloadData()
3536

3637
if let placeholderColor = theme.placeholderColor {
@@ -78,6 +79,7 @@ open class SearchTextField: UITextField {
7879
open var userStoppedTypingHandler: (() -> Void)?
7980

8081
/// Set your custom set of attributes in order to highlight the string found in each item
82+
/// Set it after setting the theme
8183
open var highlightAttributes: [NSAttributedStringKey: AnyObject] = [.font: UIFont.boldSystemFont(ofSize: 10)]
8284

8385
/// Start showing the default loading indicator, useful for searches that take some time.

0 commit comments

Comments
 (0)