getbouncer / cardscan-ios

A library for scanning credit and debit cards
MIT License
207 stars 66 forks source link

Crashes on SwiftUI #295

Closed pooja1bhatia closed 2 years ago

pooja1bhatia commented 2 years ago

Hii,

This library works fine for storyboard projects, but it crashes in SwiftUI. I integrated ScanViewController in swiftUI by using UIViewControllerRepresentable. But when I click on the button to open it the App crashes.

I’m attaching my scanner file.Please review it and let me know if I’m doing something wrong.

CardScanner.swift.zip

jaimepark-stripe commented 2 years ago

Hello @pooja1bhatia! Thank you for the example file you provided. Let me try to reproduce the crash you mentioned and get back to you. Do you mind providing me the iOS and XCode version you used?

pooja1bhatia commented 2 years ago

Hii @jaimepark-stripe Xcode version is 13.1 Mac OS Version is 11.6.1 iOS version is 15.2

pooja1bhatia commented 2 years ago

The issue is fixed by replacing ScanViewController() to ScanViewController.createViewController(withDelegate: nil) Thanks!