title: How to update a text within NSView?
body: <p>I want to update a text that is added via <code>drawInRect: withAttributes:</code> in <code>NSView</code>. However, it seems that the text cannot be updated by just changing its property.</p>
  
  <pre><code>class MyView: NSView {
      var str: NSString!
  
      override func drawRect(dirtyRect: NSRect) {
          super.drawRect(dirtyRect)
  
          str = "Sample Text"
          str.drawInRect(NSMakeRect(0, 0, 60, 40), withAttributes: nil)
      }
  }
  </code></pre>
  
  <p>The code above creates the text <code>Sample Text</code> to the view, which I added on the storyboard.</p>
  
  <p>However, when I tried to update the text either by changing its property or calling <code>drawInRect: withAttributes:</code> again, the text wasn't updated at all. Here's the code:</p>
  
  <pre><code>@IBAction func callButton(sender: AnyObject) {
          myView.str = "Test"
          myView.str.drawInRect(CGRectMake(0, 0, 60, 40), withAttributes: nil)
  } 
  </code></pre>
  
  <p>Why is the text not updated? Also, how can I update the text?</p>