SHARE
TWEET

Untitled

a guest Sep 17th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top