title: How to safely wrap optional values in Swift?
body: <p>I have got this piece of code :</p>
  
  <pre><code>     var array: [Int]? = []
  
   array = data.characters.split(){$0 == ","}.map{
          (Int(String.init($0).
  stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())))!}
  </code></pre>
  
  <p>which reads the data from the file and if there are <code>Int</code>s separated by a single comma, it will convert them into array of <code>Int</code>. My question is how do I safely wrap it so I dont get this error : <code>fatal error: unexpectedly found nil while unwrapping an Optional value</code> ?</p>