Skip to content

Commit cc3c0e7

Browse files
committed
Small fixes
1 parent 863a62d commit cc3c0e7

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

Sources/BarcodeScannerController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ open class BarcodeScannerController: UIViewController {
8989
}()
9090

9191
/// The current controller's status mode.
92-
var status: Status = Status(.scanning) {
92+
var status: Status = Status(state: .scanning) {
9393
didSet {
9494
let duration = status.animated &&
9595
(status.state == .processing
@@ -102,7 +102,7 @@ open class BarcodeScannerController: UIViewController {
102102

103103
DispatchQueue.main.asyncAfter(
104104
deadline: DispatchTime.now() + Double(Int64(2.0 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) {
105-
self.status = Status(.scanning)
105+
self.status = Status(state: .scanning)
106106
}
107107

108108
return
@@ -230,7 +230,7 @@ open class BarcodeScannerController: UIViewController {
230230

231231
if authorizationStatus == .authorized {
232232
setupSession()
233-
status = Status(.scanning)
233+
status = Status(state: .scanning)
234234
} else if authorizationStatus == .notDetermined {
235235
AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo,
236236
completionHandler: { (granted: Bool) -> Void in
@@ -239,11 +239,11 @@ open class BarcodeScannerController: UIViewController {
239239
self.setupSession()
240240
}
241241

242-
self.status = granted ? Status(.scanning) : Status(.unauthorized)
242+
self.status = granted ? Status(state: .scanning) : Status(state: .unauthorized)
243243
}
244244
})
245245
} else {
246-
status = Status(.unauthorized)
246+
status = Status(state: .unauthorized)
247247
}
248248
}
249249

@@ -275,7 +275,7 @@ open class BarcodeScannerController: UIViewController {
275275
- Parameter message: Error message that overrides the message from the config.
276276
*/
277277
open func resetWithError(_ message: String? = nil) {
278-
status = Status(.notFound, text: message)
278+
status = Status(state: .notFound, text: message)
279279
}
280280

281281
/**
@@ -284,7 +284,7 @@ open class BarcodeScannerController: UIViewController {
284284
- Parameter animated: Flag to show scanner with or without animation.
285285
*/
286286
open func reset(animated: Bool = true) {
287-
status = Status(.scanning, animated: animated)
287+
status = Status(state: .scanning, animated: animated)
288288
}
289289

290290
/**
@@ -367,7 +367,7 @@ open class BarcodeScannerController: UIViewController {
367367
flashView.removeFromSuperview()
368368

369369
if processing {
370-
self.status = Status(.processing)
370+
self.status = Status(state: .processing)
371371
}
372372
})
373373
}

Sources/InfoView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class InfoView: UIVisualEffectView {
3434
/**
3535
The current info view status mode.
3636
*/
37-
var status: Status = Status(.scanning) {
37+
var status: Status = Status(state: .scanning) {
3838
didSet {
3939
setupFrames()
4040

@@ -67,7 +67,7 @@ class InfoView: UIVisualEffectView {
6767
addSubview($0)
6868
}
6969

70-
status = Status(.scanning)
70+
status = Status(state: .scanning)
7171
}
7272

7373
required init?(coder aDecoder: NSCoder) {
@@ -126,7 +126,7 @@ class InfoView: UIVisualEffectView {
126126
func animateLoading() {
127127
borderView.isHidden = false
128128

129-
animateBlur(.light)
129+
animate(blurStyle: .light)
130130
animateBorderView(CGFloat(M_PI_2))
131131
}
132132

@@ -135,14 +135,14 @@ class InfoView: UIVisualEffectView {
135135

136136
- Parameter style: The current blur style.
137137
*/
138-
func animateBlur(_ style: UIBlurEffectStyle) {
138+
func animate(blurStyle style: UIBlurEffectStyle) {
139139
guard status.state == .processing else { return }
140140

141141
UIView.animate(withDuration: 2.0, delay: 0.5, options: [.beginFromCurrentState],
142142
animations: {
143143
self.effect = UIBlurEffect(style: style)
144144
}, completion: { _ in
145-
self.animateBlur(style == .light ? .extraLight : .light)
145+
self.animate(blurStyle: style == .light ? .extraLight : .light)
146146
})
147147
}
148148

Sources/State.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct Status {
2323
- Parameter animated: A flag to enable/disable animation.
2424
- Parameter text: A text that overrides a text from the state.
2525
*/
26-
init(_ state: State, animated: Bool = true, text: String? = nil) {
26+
init(state: State, animated: Bool = true, text: String? = nil) {
2727
self.state = state
2828
self.animated = animated
2929
self.text = text ?? state.text

0 commit comments

Comments
 (0)