title: Displaying text one character at a time in swift 2.0
body: <p>New to Swift 2.0; trying to learn it, interested in animation and tried to write some code to display a message on screen one character at a time. </p>
  
  <p>I wrote this, it works, but I cannot help but could I not do something with CALayers perhaps and/or alpha values? Or some animate gizmo, something more swift worthy; this feels &amp; looks kinda clunky, sort 1977 really.</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  
  
  let supertext  = "A long time ago, in a galaxy far, far away ..."
  let round = supertext.characters.count
  for i in 0...round {
      let delay = Double(i)/10
      let subtext = supertext[supertext.startIndex..&lt;supertext.startIndex.advancedBy(i)]
      NSTimer.scheduledTimerWithTimeInterval(delay, target: self, selector: "ghostText:", userInfo: ["theText" :subtext], repeats: false)
      }
  }
  
  var view3:UITextView = UITextView()
  
  func ghostText(timer:NSTimer) {
      view3.removeFromSuperview()
      let userInfo = timer.userInfo as! Dictionary&lt;String, AnyObject&gt;
      let tempText:NSString = (userInfo["theText"] as! NSString)
      print(tempText)
  
      let font = UIFont(name: "Georgia", size: 18.0) ?? UIFont.systemFontOfSize(18.0)
      let textFont = [NSFontAttributeName:font]
  
      let subChararacter = NSAttributedString(string: String(tempText), attributes: textFont)
      view3.frame = CGRect(x: 100, y: 120, width: CGRectGetWidth(self.view.frame), height: CGRectGetWidth(self.view.frame)-20)
      view3.attributedText = subChararacter
      self.view.addSubview(view3)
  }
  </code></pre>