title: How to convert hexadecimal string to an array of UInt8 bytes in Swift?
body: <p>I have the following code: </p>
  
  <pre><code>var encryptedByteArray: Array&lt;UInt8&gt;?
  do {
      let aes = try AES(key: "passwordpassword", iv: "drowssapdrowssap")
      encryptedByteArray = try aes.encrypt(Array("ThisIsAnExample".utf8))
  } catch {
      fatalError("Failed to initiate aes!")
  }
  
  print(encryptedByteArray!) // Prints [224, 105, 99, 73, 119, 70, 6, 241, 181, 96, 47, 250, 108, 45, 149, 63]
  
  let hexString = encryptedByteArray?.toHexString()
  
  print(hexString!) // Prints e0696349774606f1b5602ffa6c2d953f
  </code></pre>
  
  <p>How can I convert <code>hexString</code> back to the same array of <code>UInt8</code> bytes?</p>
  
  <p>The reason why I am asking is because I want to communicate with a server through an encrypted hexadecimal string and I need to convert it back to an array of <code>UInt8</code> bytes to decode the string to its original form.</p>