Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func strikeThrough(thickness: Int, subString: String) {
- if let range = self.string.range(of: subString) {
- self.strikeThrough(thickness: thickness, onRange: NSRange(range, in: self.string))
- }
- }
- func strikeThrough(thickness: Int, onRange: NSRange) {
- self.addAttributes([NSAttributedString.Key.strikethroughStyle : NSUnderlineStyle.thick.rawValue],
- range: onRange)
- }
- func applyStroke(color: UIColor, thickness: Int, subString: String) {
- if let range = self.string.range(of: subString) {
- self.applyStroke(color: color, thickness: thickness, onRange: NSRange(range, in: self.string))
- }
- }
- func applyStroke(color: UIColor, thickness: Int, onRange: NSRange) {
- self.addAttributes([NSAttributedString.Key.strokeColor : color],
- range: onRange)
- self.addAttributes([NSAttributedString.Key.strokeWidth : thickness],
- range: onRange)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement