vinodiOS/SwiftQRCodeScanner

Is it allow to scan from gallery image? or any static image

Closed this issue · 4 comments

Will you please help me out I need to access from gallery image to scan. if it is possible using this pod let me know please.

Yes @Naiyer95 ! You can scan image from gallery using "Upload from photos" button. Make sure you have given Photo Library request permission in info.plist

@vinodiOS can you send the code for this please how it will be call with scanner.

import UIKit
import SwiftQRScanner

class ViewController: UIViewController {
    
    @IBAction func scanQRCode(_ sender: Any) {

        let scanner = QRCodeScannerController()
        scanner.delegate = self
        self.present(scanner, animated: true, completion: nil)
    }
}

extension ViewController: QRScannerCodeDelegate {
    func qrScannerDidFail(_ controller: UIViewController, error: QRCodeError) {
        print("error:\(error.localizedDescription)")
    }
    
    func qrScanner(_ controller: UIViewController, scanDidComplete result: String) {
        print("result:\(result)")
    }
    
    func qrScannerDidCancel(_ controller: UIViewController) {
        print("SwiftQRScanner did cancel")
    }
}

Thank you so much @vinodiOS