title: How to check if TextView is empty?
body: <p>I have used this code to check if Textview is empty or not. It works fine if I will give space, but if I will press "Enter" button it allows me to enter my Data in Database. What is wrong with this?</p>
  
  <pre><code>func validation()-&gt;Int
  {
      var i = 1
  
      //1st way
  
      if txt_view.text.isEmpty
      {
          var alert = UIAlertView()
          alert.title = "Message"
          alert.message = "Write Career Objective"
          alert.addButtonWithTitle("OK")
          alert.show()
          i = 0
      }
  
      //2nd way
  
      if txt_view.text.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet()) == ""
      {
          var alert = UIAlertView()
          alert.title = "Message"
          alert.message = "Write Career Objective"
          alert.addButtonWithTitle("OK")
          alert.show()
          i = 0
      }
  
      return i
  }
  </code></pre>