Profile
Back to NewsBack
GitHub Trending 2 min
Reader Mode
younatics/Highlighter: 🖍 Highlight whatever you want!

younatics/Highlighter: 🖍 Highlight whatever you want!

10 hours ago

Highlighter

Awesome</a> Swift Package Manager</a> CocoaPods</a> Platform</a> Swift 6</a> License: MIT</a>

Updates

See
CHANGELOG for details

Introduction

🖍 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

!demo

Requirements

Highlighter requires Swift 6.0 (swift-tools-version 6.0) and iOS 13.0 or later. It supports Swift Package Manager and CocoaPods.

Installation

Swift Package Manager

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")
]

CocoaPods

Highlighter is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Highlighter', '2.0.0'

Usage

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)

Examples

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 }

References

Please tell me or make pull request if you use this library in your application :)

MotionBook

YNSearch

Author

younatics Twitter

License

Highlighter is available under the MIT license. See the LICENSE file for more info.
Our Related Projects
Farm Fresh Kikapu

An e-commerce platform for farm-fresh produce - an online st...

View Project
Chat with me