title: Generating UUIDs with Swift
body: <p>I'm trying to generate a UUID using Swift. The official documentation is confusing me a little bit.</p>
  
  <p>The <a href="https://developer.apple.com/documentation/foundation/uuid" rel="noreferrer">documentation</a> says</p>
  
  <blockquote>
    <p><code>init?(uuidString: String)</code>
    Create a UUID from a string such as “E621E1F8-C36C-495A-93FC-0C247A3E6E5F”.</p>
  </blockquote>
  
  <p>Does this mean that the string I need to create the UUID from has to be in that format?</p>
  
  <p>For a project I'm doing, I have a string and I want to generate a UUID specifically for that string. </p>
  
  <p>Here's what I tried: </p>
  
  <pre><code>import Foundation
  
  var str = UUID(uuidString: "Hello World")
  print(str.uuidString)
  </code></pre>
  
  <p>This gives me the error, </p>
  
  <blockquote>
    <p>value of optional type 'UUID?' not unwrapped; did you mean to use '!'
    or '?'?</p>
  </blockquote>
  
  <p>I'm still very new to Swift and all this. I don't know what to do in this case.</p>
  
  <p>Basically, I need to generate a UUID SPECIFICALLY for a string (such as "Hello world"), and then I want to use the UUID to return the original string.</p>