[ADD] Convenience init

This commit is contained in:
Yannick Loriot 2016-01-11 21:40:35 +01:00
parent f3414efe59
commit ca8d35b742
3 changed files with 41 additions and 15 deletions

View File

@ -1,5 +1,11 @@
# Change log
## [Version 5.3.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/5.3.0)
Released on 2016-01-11.
- [ADD] Return a `QRCodeReaderResult` instead of a string.
- [ADD] Convenience init with QRCode metadata type.
## [Version 5.2.1](https://github.com/yannickl/QRCodeReader.swift/releases/tag/5.2.1)
Released on 2015-11-07.

View File

@ -70,6 +70,13 @@ public final class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegat
// MARK: - Creating the Code Reader
/**
Initializes the code reader with the QRCode metadata type object.
*/
public convenience override init() {
self.init(metadataObjectTypes: [AVMetadataObjectTypeQRCode])
}
/**
Initializes the code reader with an array of metadata object types.

View File

@ -1,19 +1,32 @@
//
// QRCodeReaderResult.swift
// Pods
//
// Created by philippe on 15/12/2015.
//
//
/*
* QRCodeReader.swift
*
* Copyright 2014-present Yannick Loriot.
* http://yannickloriot.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
import Foundation
public class QRCodeReaderResult: NSObject{
public let value: String?
public let type: String?
init(value: String?, type: String?) {
self.value = value
self.type = type
}
public struct QRCodeReaderResult {
public let value: String?
public let type: String?
}