xcode - "Right way" to add attributes to all numbers in NSMutableAttributedString -


Is this a good way to add attributes to all numbers in NSMutableAttributedString?

  Let's Reg: NSRegularExpression = NSRegularExpression (pattern: "\\ d +", option: zero, error: zero)! Reg.enumerateMatchesInString (str, option: zero, category: NSMakeRange (0, str.length)) {(Results, _, _) - & gt; Paragraph The attribute attribute contains zero (attribute name, value: attribute view, category: result. Line)}  

Or maybe it should be done in another way? I'm completely new to XCode (coming from "PHP world"), so I want to make sure that I'm doing things in Swift just as I should.


Comments