Easy Attributer is a library that generates attributed string by matched regexes.
This is how EasyAttributer works:
- Support custom regex.
- High performance.
- Easy to use
- iOS 11.0+
- Swift 5.0+
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website.
You can install Cocoapods with the following command:
$ gem install cocoapods
To integrate EasyAttributer into your Xcode project using CocoaPods, specify it in your Podfile
.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target <'Your target name'> do
pod 'EasyAttributer'
end
Before anything review project UnitTests and example.
- Create instance of
EasyAttributer
. - Pass your custom regexes to
EasyAttributer
instance. - Call
transform(:_)
method. - Finish :)
EasyAttributer is a type that accepts an array of 'ESRegexBehavior' and transforms it into your custom attributed string.
public struct EasyAttributer
Return the none-mutable attributed string and attributes your regex matches.
- Parameters:
- text: text that transformer searches for regex patterns.
- matchAttribute: A callback that calls on every match. Use this to attribute to your matches.
public func transform(text: String, attribute matchAttribute: @escaping (ESTextResult) -> [NSAttributedString.Key : Any]) throws -> NSAttributedString?
A regex behavior type. Create your regex by conforming to this protocol.
public protocol ESRegexBehavior
Hey there! I'm fueled by coffee and code ☕️ If you're enjoying my work, consider buying me a coffee to keep me motivated and productive. Your caffeine-powered contribution will keep me going and help me to develop even better projects. Thanks for keeping me caffeinated and inspired!
TRC20 USDT address TFZ4XoNo6F2kz6PUgk5SBmWoGULoB67vWV
sadeq, [email protected]
EasyAttributer is available under the MIT license. See the LICENSE file for more info.