title: Scan QR Code and open URL – Swift AVFoundation library
body: <p>Sorry, this is my very first iOS app! I am trying to implement a very simple QR code scanner to the app using QRCodeReader.swift but I have no idea how to handle the URL from the result. It is supposed to redirect instantly to the link but is not working. Thank you!</p>
  
  <pre><code>func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeReaderResult) {
  reader.stopScanning()
  
  
  dismiss(animated: true) { [weak self] in
  
  
  let url = URL(string: result.value)!
  if #available(iOS 10.0, *) {
      UIApplication.shared.open(url, options: [:], completionHandler: nil)
  } else {
      UIApplication.shared.openURL(url)
  }
  
  
  }
  }
  </code></pre>