title: NSAttributed string not working in swift
body: <p>I am trying to use attributed string to customize a label but getting weird errors in swift.</p>
  
  <pre><code>func redBlackSubstring(substring: String) {
      self.font = UIFont(name: "HelveticaNeue", size: 12.0)
      var theRange: Range&lt;String.Index&gt;! = self.text?.rangeOfString(substring)
      var attributedString = NSMutableAttributedString(string: self.text!)
  
      let attribute = [NSForegroundColorAttributeName as NSString: UIColor.blackColor()]
      attributedString.setAttributes(attribute, range: self.text?.rangeOfString(substring))
      self.attributedText = attributedString
  }
  </code></pre>
  
  <p>I have also tried using the below code</p>
  
  <pre><code>func redBlackSubstring(substring: String) {
      self.font = UIFont(name: "HelveticaNeue", size: 12.0)
      var theRange: Range&lt;String.Index&gt;! = self.text?.rangeOfString(substring)
      var attributedString = NSMutableAttributedString(string: self.text!)
      attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.redColor(), range: self.text?.rangeOfString(substring))
      self.attributedText = attributedString
  }
  </code></pre>
  
  <p>In both the cases, getting weird errors "Can not invoke 'setAttributes' with an argument list of type '([NSString : ..."</p>
  
  <p>I have tried most of the solutions available on stack overflow and many other tutorials but, all of them resulting in such errors.</p>