Skip to content

Commit 20cb403

Browse files
committed
Fixing example project
1 parent a8b4576 commit 20cb403

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Version 10.0.0
44

55
- [ADD] Allowing the scan area configuration (#157 #106)
6+
- [UPDATE] The `showOverlayView` builder property is now `false` by default
67

78
## [Version 9.0.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/9.0.0)
89
Release on 2018-09-19

Example/QRCodeReader.swift/Base.lproj/Main.storyboard

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
9-
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
109
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1110
</dependencies>
1211
<scenes>
@@ -23,7 +22,7 @@
2322
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2423
<subviews>
2524
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MLx-jM-72O">
26-
<rect key="frame" x="27.5" y="258" width="320" height="150"/>
25+
<rect key="frame" x="27.5" y="258.5" width="320" height="150"/>
2726
<subviews>
2827
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P5n-CT-PTt">
2928
<rect key="frame" x="0.0" y="0.0" width="150" height="150"/>
@@ -63,8 +62,8 @@
6362
</constraints>
6463
</view>
6564
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ROG-L6-Gnz" customClass="QRCodeReaderView" customModule="QRCodeReader_swift" customModuleProvider="target">
66-
<rect key="frame" x="87" y="42" width="200" height="200"/>
67-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
65+
<rect key="frame" x="87.5" y="42.5" width="200" height="200"/>
66+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
6867
<constraints>
6968
<constraint firstAttribute="width" secondItem="ROG-L6-Gnz" secondAttribute="height" multiplier="1:1" id="5Br-7H-vZp"/>
7069
<constraint firstAttribute="height" constant="200" id="m30-Dq-t2L"/>

Example/QRCodeReader.swift/ViewController.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ class ViewController: UIViewController, QRCodeReaderViewControllerDelegate {
3131
@IBOutlet weak var previewView: QRCodeReaderView! {
3232
didSet {
3333
previewView.setupComponents(with: QRCodeReaderViewControllerBuilder {
34-
$0.reader = reader
35-
$0.showTorchButton = false
34+
$0.reader = reader
35+
$0.showTorchButton = false
3636
$0.showSwitchCameraButton = false
37+
$0.showCancelButton = false
38+
$0.showOverlayView = true
39+
$0.rectOfInterest = CGRect(x: 0.2, y: 0.2, width: 0.6, height: 0.6)
3740
})
3841
}
3942
}
@@ -43,7 +46,8 @@ class ViewController: UIViewController, QRCodeReaderViewControllerDelegate {
4346
$0.reader = QRCodeReader(metadataObjectTypes: [.qr], captureDevicePosition: .back)
4447
$0.showTorchButton = true
4548
$0.preferredStatusBarStyle = .lightContent
46-
$0.rectOfInterest = CGRect(x: 0.15, y: 0.15, width: 0.7, height: 0.7)
49+
$0.showOverlayView = true
50+
$0.rectOfInterest = CGRect(x: 0.2, y: 0.2, width: 0.6, height: 0.6)
4751

4852
$0.reader.stopScanningWhenCodeIsFound = false
4953
}
@@ -126,7 +130,7 @@ class ViewController: UIViewController, QRCodeReaderViewControllerDelegate {
126130
}
127131

128132
func reader(_ reader: QRCodeReaderViewController, didSwitchCamera newCaptureDevice: AVCaptureDeviceInput) {
129-
print("Switching capturing to: \(newCaptureDevice.device.localizedName)")
133+
print("Switching capture to: \(newCaptureDevice.device.localizedName)")
130134
}
131135

132136
func readerDidCancel(_ reader: QRCodeReaderViewController) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func reader(_ reader: QRCodeReaderViewController, didScanResult result: QRCodeRe
7878
//By pressing on the switch camera button
7979
func reader(_ reader: QRCodeReaderViewController, didSwitchCamera newCaptureDevice: AVCaptureDeviceInput) {
8080
if let cameraName = newCaptureDevice.device.localizedName {
81-
print("Switching capturing to: \(cameraName)")
81+
print("Switching capture to: \(cameraName)")
8282
}
8383
}
8484

Sources/QRCodeReaderView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ final public class QRCodeReaderView: UIView, QRCodeReaderDisplayable {
126126
// MARK: - Scan Result Indication
127127

128128
func startTimerForBorderReset() {
129-
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(1)) {
129+
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) {
130130
if let ovl = self.overlayView as? ReaderOverlayView {
131131
ovl.overlayColor = .white
132132
}

Sources/QRCodeReaderViewControllerBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public final class QRCodeReaderViewControllerBuilder {
9494
/**
9595
Flag to display the guide view.
9696
*/
97-
public var showOverlayView = true
97+
public var showOverlayView = false
9898

9999
/**
100100
Flag to display the guide view.

0 commit comments

Comments
 (0)