Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. func strikeThrough(thickness: Int, subString: String) {
  2. if let range = self.string.range(of: subString) {
  3. self.strikeThrough(thickness: thickness, onRange: NSRange(range, in: self.string))
  4. }
  5. }
  6. func strikeThrough(thickness: Int, onRange: NSRange) {
  7.  
  8. self.addAttributes([NSAttributedString.Key.strikethroughStyle : NSUnderlineStyle.thick.rawValue],
  9. range: onRange)
  10. }
  11. func applyStroke(color: UIColor, thickness: Int, subString: String) {
  12. if let range = self.string.range(of: subString) {
  13. self.applyStroke(color: color, thickness: thickness, onRange: NSRange(range, in: self.string))
  14. }
  15. }
  16. func applyStroke(color: UIColor, thickness: Int, onRange: NSRange) {
  17. self.addAttributes([NSAttributedString.Key.strokeColor : color],
  18. range: onRange)
  19. self.addAttributes([NSAttributedString.Key.strokeWidth : thickness],
  20. range: onRange)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement