The ReaderOverlayView, SwitchCameraButton and ToggleTorchButton are now public
This commit is contained in:
parent
d6b85ec9b4
commit
684df7fe39
|
@ -1,5 +1,12 @@
|
|||
# Change log
|
||||
|
||||
## [Version 7.2.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/7.2.0)
|
||||
Released on 2016-10-20.
|
||||
|
||||
- [REFACTORING] The `QRCodeReaderViewController`'s view is now build via the `QRCodeReaderContainer`
|
||||
- [REFACTORING] The `ReaderOverlayView`, `SwitchCameraButton` and `ToggleTorchButton` are now public
|
||||
- [ADD] The `readerView` property in the `QRCodeViewControllerBuilder` to allow view customization
|
||||
|
||||
## [Version 7.1.0](https://github.com/yannickl/QRCodeReader.swift/releases/tag/7.1.0)
|
||||
Released on 2016-10-12.
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
import UIKit
|
||||
|
||||
/// Overlay over the camera view to display the area (a square) where to scan the code.
|
||||
final class ReaderOverlayView: UIView {
|
||||
public final class ReaderOverlayView: UIView {
|
||||
private var overlay: CAShapeLayer = {
|
||||
var overlay = CAShapeLayer()
|
||||
overlay.backgroundColor = UIColor.clear.cgColor
|
||||
|
@ -46,7 +46,7 @@ final class ReaderOverlayView: UIView {
|
|||
setupOverlay()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
|
||||
setupOverlay()
|
||||
|
@ -56,7 +56,7 @@ final class ReaderOverlayView: UIView {
|
|||
layer.addSublayer(overlay)
|
||||
}
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
public override func draw(_ rect: CGRect) {
|
||||
var innerRect = rect.insetBy(dx: 50, dy: 50)
|
||||
let minSize = min(innerRect.width, innerRect.height)
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
import UIKit
|
||||
|
||||
/// The camera switch button.
|
||||
@IBDesignable final class SwitchCameraButton: UIButton {
|
||||
@IBDesignable
|
||||
public final class SwitchCameraButton: UIButton {
|
||||
@IBInspectable var edgeColor: UIColor = UIColor.white {
|
||||
didSet {
|
||||
setNeedsDisplay()
|
||||
|
@ -43,7 +44,7 @@ import UIKit
|
|||
@IBInspectable var edgeHighlightedColor: UIColor = UIColor.white
|
||||
@IBInspectable var fillHighlightedColor: UIColor = UIColor.black
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
public override func draw(_ rect: CGRect) {
|
||||
let width = rect.width
|
||||
let height = rect.height
|
||||
let center = width / 2
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
import UIKit
|
||||
|
||||
/// The toggle torch button.
|
||||
@IBDesignable final class ToggleTorchButton: UIButton {
|
||||
@IBDesignable
|
||||
public final class ToggleTorchButton: UIButton {
|
||||
@IBInspectable var edgeColor: UIColor = UIColor.white {
|
||||
didSet {
|
||||
setNeedsDisplay()
|
||||
|
@ -43,7 +44,7 @@ import UIKit
|
|||
@IBInspectable var edgeHighlightedColor: UIColor = UIColor.white
|
||||
@IBInspectable var fillHighlightedColor: UIColor = UIColor.darkGray
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
public override func draw(_ rect: CGRect) {
|
||||
// Colors
|
||||
let paintColor = (self.state != .highlighted) ? fillColor : fillHighlightedColor
|
||||
let strokeColor = (self.state != .highlighted) ? edgeColor : edgeHighlightedColor
|
||||
|
@ -99,24 +100,24 @@ import UIKit
|
|||
|
||||
// MARK: - UIResponder Methods
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
setNeedsDisplay()
|
||||
}
|
||||
|
||||
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
public override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
super.touchesMoved(touches, with: event)
|
||||
|
||||
setNeedsDisplay()
|
||||
}
|
||||
|
||||
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||
super.touchesEnded(touches, with: event)
|
||||
setNeedsDisplay()
|
||||
}
|
||||
|
||||
override func touchesCancelled(_ touches: Set<UITouch>?, with event: UIEvent?) {
|
||||
public override func touchesCancelled(_ touches: Set<UITouch>?, with event: UIEvent?) {
|
||||
super.touchesCancelled(touches!, with: event)
|
||||
|
||||
setNeedsDisplay()
|
||||
|
|
Loading…
Reference in New Issue