Use QRCodeReaderViewControllerBuilder instead of QRCodeViewControllerBuilder
This commit is contained in:
parent
f41169c7ca
commit
bd3103202a
|
@ -5,6 +5,8 @@ Released on 2016-06-15.
|
|||
|
||||
- Swift 3 supports
|
||||
|
||||
- Use `QRCodeReaderViewControllerBuilder` instead of `QRCodeViewControllerBuilder`
|
||||
|
||||
`QRCodeReader`:
|
||||
- Use `didFindCode` instead of `didFindCodeBlock`
|
||||
- Use `isRunning` instead of `running`
|
||||
|
@ -12,6 +14,11 @@ Released on 2016-06-15.
|
|||
- `hasFrontDevice` is a property
|
||||
- `isTorchAvailable` is a property
|
||||
|
||||
## [Version 6.1.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/6.1.0)
|
||||
Released on 2016-08-03.
|
||||
|
||||
- Hide/Display cancel button
|
||||
|
||||
## [Version 6.0.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/6.0.0)
|
||||
Released on 2016-03-22.
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
|
@ -14,26 +15,24 @@
|
|||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="1024" height="1366"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P5n-CT-PTt">
|
||||
<rect key="frame" x="222" y="225" width="155" height="150"/>
|
||||
<animations/>
|
||||
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P5n-CT-PTt">
|
||||
<frame key="frameInset" minX="222" minY="225" width="155" height="150"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="155" id="O9u-YB-D6M"/>
|
||||
<constraint firstAttribute="height" constant="150" id="h6v-qf-cpj"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Scan">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="scanAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Tum-8Y-xC0"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="P5n-CT-PTt" secondAttribute="centerX" constant="0.5" id="CeZ-ED-sHl"/>
|
||||
<constraint firstAttribute="centerY" secondItem="P5n-CT-PTt" secondAttribute="centerY" id="fM5-Fa-KlF"/>
|
||||
|
|
|
@ -29,7 +29,7 @@ import AVFoundation
|
|||
|
||||
class ViewController: UIViewController, QRCodeReaderViewControllerDelegate {
|
||||
lazy var reader: QRCodeReaderViewController = {
|
||||
let builder = QRCodeViewControllerBuilder { builder in
|
||||
let builder = QRCodeReaderViewControllerBuilder { builder in
|
||||
builder.reader = QRCodeReader(metadataObjectTypes: [AVMetadataObjectTypeQRCode])
|
||||
builder.showTorchButton = true
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
- parameter showTorchButton: Flag to display the toggle torch button. If the value is true and there is no torch the button will not be displayed.
|
||||
*/
|
||||
public convenience init(cancelButtonTitle: String, codeReader reader: QRCodeReader, startScanningAtLoad startScan: Bool = true, showSwitchCameraButton showSwitch: Bool = true, showTorchButton showTorch: Bool = false) {
|
||||
self.init(builder: QRCodeViewControllerBuilder { builder in
|
||||
self.init(builder: QRCodeReaderViewControllerBuilder { builder in
|
||||
builder.cancelButtonTitle = cancelButtonTitle
|
||||
builder.reader = reader
|
||||
builder.startScanningAtLoad = startScan
|
||||
|
@ -120,7 +120,7 @@ public class QRCodeReaderViewController: UIViewController {
|
|||
|
||||
- parameter builder: A QRCodeViewController builder object.
|
||||
*/
|
||||
required public init(builder: QRCodeViewControllerBuilder) {
|
||||
required public init(builder: QRCodeReaderViewControllerBuilder) {
|
||||
startScanningAtLoad = builder.startScanningAtLoad
|
||||
codeReader = builder.reader
|
||||
showSwitchCameraButton = builder.showSwitchCameraButton
|
|
@ -30,14 +30,14 @@ import Foundation
|
|||
The QRCodeViewControllerBuilder aims to create a simple configuration object for
|
||||
the QRCode view controller.
|
||||
*/
|
||||
public final class QRCodeViewControllerBuilder {
|
||||
public final class QRCodeReaderViewControllerBuilder {
|
||||
// MARK: - Configuring the QRCodeViewController Objects
|
||||
|
||||
/**
|
||||
The builder block.
|
||||
The block gives a reference of builder you can configure.
|
||||
*/
|
||||
public typealias QRCodeViewControllerBuilderBlock = (QRCodeViewControllerBuilder) -> Void
|
||||
public typealias QRCodeReaderViewControllerBuilderBlock = (QRCodeReaderViewControllerBuilder) -> Void
|
||||
|
||||
/**
|
||||
The title to use for the cancel button.
|
||||
|
@ -72,11 +72,11 @@ public final class QRCodeViewControllerBuilder {
|
|||
public init() {}
|
||||
|
||||
/**
|
||||
Initialize a QRCodeViewController builder with default values.
|
||||
Initialize a QRCodeReaderViewController builder with default values.
|
||||
|
||||
- parameter buildBlock: A QRCodeViewController builder block to configure itself.
|
||||
- parameter buildBlock: A QRCodeReaderViewController builder block to configure itself.
|
||||
*/
|
||||
public init(buildBlock: QRCodeViewControllerBuilderBlock) {
|
||||
public init(buildBlock: QRCodeReaderViewControllerBuilderBlock) {
|
||||
buildBlock(self)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue