See CHANGELOG for details
🖍 Highlight whatever you want! Highlighter will magically find UI objects such as UILabel, UITextView, UITextField, UIButton in your UITableViewCell or other Class.
See YNSearch for advanced usage
Highlighter requires Swift 6.0 (swift-tools-version 6.0) and iOS 13.0 or later. It supports Swift Package Manager and CocoaPods.
In Xcode, choose File ▸ Add Package Dependencies… and enter:
https://github.com/younatics/Highlighter.git
Or add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/younatics/Highlighter.git", from: "2.0.0")
]Highlighter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Highlighter', '2.0.0'You can highlight a UILabel, UITextView, UITextField, or UIButton using highlight(text:normal:highlight:).
When you call highlight(text:normal:highlight:type:) on a container such as a custom UIView or UITableViewCell, Highlighter inspects the container's stored properties and highlights directly stored supported controls. It does not recursively search UIView.subviews.
To highlight all supported controls stored as properties, use:
view.highlight(text: "Foo", normal: normalAttributes, highlight: highlightedAttributes)Or limit the stored properties to a single control type:
view.highlight(text: "Foo", normal: normalAttributes, highlight: highlightedAttributes, type: UIButton.self)func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = self.ynSearchListViewDelegate?.ynSearchListView(tableView, cellForRowAt: indexPath) as? SearchViewCell else { return UITableViewCell() }
if let changedText = ynSearchTextFieldText {
cell.highlight(text: changedText, normal: nil, highlight: [.backgroundColor: UIColor.yellow])
}
return cell
}Highlighter is available under the MIT license. See the LICENSE file for more info.
