Swift 3 method to create utf8 encoded Data from String : <p>I know there's a bunch of pre Swift3 questions regarding NSData stuff. I'm curious how to go between a Swift3 <code>String</code> to a utf8 encoded (with or without null termination) to Swift3 <code>Data</code> object.</p>

<p>The best I've come up with so far is:</p>

<pre><code>let input = "Hello World"
let terminatedData = Data(bytes: Array(input.nulTerminatedUTF8))
let unterminatedData = Data(bytes: Array(input.utf8))
</code></pre>

<p>Having to do the intermediate <code>Array()</code> construction seems wrong.</p>
