title: Swift change color of text using NSMutableAttributedStrings
body: <p>I have a <code>UITableView</code> and i would like to display the text of each row using different colors within the same line.</p>
  
  <p>I've tried this code, trying to translate from Obj-C but i cannot have it working</p>
  
  <pre><code>        let object = self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject
  
          var attrString: NSMutableAttributedString = NSMutableAttributedString(string: object.valueForKey("example1")!.description)
          attrString.addAttribute(NSForegroundColorAttributeName, value: UIColor.redColor(), range: NSMakeRange(0, attrString.length))
  
          var stringToCell:String = String(format: "%@    %@", attrString, object.valueForKey("example2")!.description)
          cell.textLabel?.text = stringToCell
  </code></pre>
  
  <p>The output of all this is 
  <img src="https://i.stack.imgur.com/yl6yv.png" alt="enter image description here"></p>
  
  <p>where the number 34 correspond to <code>object.valueForKey("example1")!.description</code>, so the problem is that the number is <strong>not</strong> red, and the second part (<code>object.valueForKey("example2")!.description</code>) is replaced by <code>{</code>.</p>
  
  <p>If I leave this piece of code regarding <code>NSAttributedString</code> the row text is displayed correctly.</p>