title: How to extend String's UnsafePointer<Int8> initializer to accept NULL pointers?
body: <p>In Swift, there's a String initialiser that takes an <code>UnsafePointer&lt;Int8&gt;</code> (or <code>UnsafePointer&lt;CChar&gt;</code> which is the same I think) as an argument. </p>
  
  <p>However, there's no initialiser that takes an optional <code>UnsafePointer</code>, e.g. a pointer that's <code>NULL</code> (or nil, speaking swifty), which can be extremely helpful when working with a C API.</p>
  
  <p>I'd like to extend the String class to accept optional unsafe pointers.</p>
  
  <p>This is what my extension looks like. Is that correct? Is this how one would implement that feature?</p>
  
  <pre class="lang-swift prettyprint-override"><code>extension String {
      init?(cString: UnsafePointer&lt;Int8&gt;?) {
          guard let cString = cString else { return nil }
          self = String(cString: cString)
      }
  }
  </code></pre>