@@ -46,6 +46,13 @@ Then just follow these steps:
4646lazy var readerVC: QRCodeReaderViewController = {
4747 let builder = QRCodeReaderViewControllerBuilder {
4848 $0 .reader = QRCodeReader (metadataObjectTypes : [.qr ], captureDevicePosition : .back )
49+
50+ // Configure the view controller (optional)
51+ $0 .showTorchButton = false
52+ $0 .showSwitchCameraButton = false
53+ $0 .showCancelButton = false
54+ $0 .showOverlayView = true
55+ $0 .rectOfInterest = CGRect (x : 0.2 , y : 0.2 , width : 0.6 , height : 0.6 )
4956 }
5057
5158 return QRCodeReaderViewController (builder : builder)
@@ -63,6 +70,7 @@ lazy var readerVC: QRCodeReaderViewController = {
6370
6471 // Presents the readerVC as modal form sheet
6572 readerVC.modalPresentationStyle = .formSheet
73+
6674 present (readerVC, animated : true , completion : nil )
6775}
6876
@@ -103,7 +111,7 @@ class YourCustomView: UIView, QRCodeReaderDisplayable {
103111 let toggleTorchButton: UIButton? = ToggleTorchButton ()
104112 var overlayView: UIView? = UIView ()
105113
106- func setupComponents (showCancelButton : Bool , showSwitchCameraButton : Bool , showTorchButton : Bool , showOverlayView : Bool ) {
114+ func setupComponents (with builder : QRCodeReaderViewControllerBuilder ) {
107115 // addSubviews
108116 // setup constraints
109117 // etc.
@@ -129,13 +137,13 @@ The recommended approach to use _QRCodeReaderViewController_ in your project is
129137
130138Install CocoaPods if not already available:
131139
132- ``` bash
140+ ``` bash
133141$ [sudo] gem install cocoapods
134142$ pod setup
135143```
136144Go to the directory of your Xcode project, and Create and Edit your Podfile and add _ QRCodeReader.swift_ to your corresponding ` TargetName ` :
137145
138- ``` bash
146+ ``` bash
139147$ cd /path/to/MyProject
140148$ touch Podfile
141149$ edit Podfile
@@ -150,13 +158,13 @@ end
150158
151159Install into your project:
152160
153- ``` bash
161+ ``` bash
154162$ pod install
155163```
156164
157165Open your project in Xcode from the .xcworkspace file (not the usual project file):
158166
159- ``` bash
167+ ``` bash
160168$ open MyProject.xcworkspace
161169```
162170
0 commit comments