title: Convert byte array to PDF in swift 3
body: <p>What am trying to do is, get the byte array response from api response, and save that to file (PDF).</p>
  
  <p>(Server returns a bytearray)</p>
  
  <p>Am using <code>Alamofire</code> for web requests,</p>
  
  <pre><code>Alamofire.request("\(BaseUrl)api/mobile/downloadResume", headers : ProfileViewHeader)
          .response { response in
      print(response)
          // let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
          // let filePath = "\(documentsPath)/readingfile.pdf"
          // let data:NSData = NSKeyedArchiver.archivedData(withRootObject: response.data) as NSData
          // let file = data.write(toFile: filePath, atomically: false)
  }
  </code></pre>
  
  <p>Am getting the byte array response without any issues,</p>
  
  <p>My main problem is how to save the byte array in a file. I have done the same in Android without any issues, but not able achieve the same in swift,</p>
  
  <p>Any kind of help will be greatly appreciated. Please help me out.</p>
  
  <p>Thanks</p>