Skip to content

Commit 4a8ae52

Browse files
committed
Merge branch 'master' into fix/torch-mode
2 parents 3cbe0c2 + 6eee165 commit 4a8ae52

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

BarcodeScanner.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "BarcodeScanner"
33
s.summary = "Simple and beautiful barcode scanner."
4-
s.version = "4.1.0"
4+
s.version = "4.1.1"
55
s.homepage = "https://github.com/hyperoslo/BarcodeScanner"
66
s.license = 'MIT'
77
s.author = { "Hyper Interaktiv AS" => "[email protected]" }

Example/BarcodeScannerExample/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- BarcodeScanner (4.1.0)
2+
- BarcodeScanner (4.1.1)
33

44
DEPENDENCIES:
55
- BarcodeScanner (from `../../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: ../../
1010

1111
SPEC CHECKSUMS:
12-
BarcodeScanner: 1d811612a55549741cc9dcfecdd6e562d9982edb
12+
BarcodeScanner: 91ac9634d249b4e59a5b57dff9264b691bc99ea6
1313

1414
PODFILE CHECKSUM: ea40d735f047f0ae7ae319d7a320a82facf3361f
1515

Sources/Controllers/MessageViewController.swift

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public final class MessageViewController: UIViewController {
1212
// MARK: - UI properties
1313

1414
/// Text label.
15-
public private(set) lazy var textLabel: UILabel = .init()
15+
public private(set) lazy var textLabel: UILabel = self.makeTextLabel()
1616
/// Info image view.
17-
public private(set) lazy var imageView: UIImageView = .init()
17+
public private(set) lazy var imageView: UIImageView = self.makeImageView()
1818
/// Border view.
19-
public private(set) lazy var borderView: UIView = .init()
19+
public private(set) lazy var borderView: UIView = self.makeBorderView()
2020

2121
/// Blur effect view.
2222
private lazy var blurView: UIVisualEffectView = .init(effect: UIBlurEffect(style: .extraLight))
@@ -37,7 +37,6 @@ public final class MessageViewController: UIViewController {
3737
super.viewDidLoad()
3838
view.addSubview(blurView)
3939
blurView.contentView.addSubviews(textLabel, imageView, borderView)
40-
setupSubviews()
4140
handleStatusUpdate()
4241
}
4342

@@ -99,24 +98,6 @@ public final class MessageViewController: UIViewController {
9998
}))
10099
}
101100

102-
// MARK: - Subviews
103-
104-
private func setupSubviews() {
105-
textLabel.translatesAutoresizingMaskIntoConstraints = false
106-
textLabel.textColor = .black
107-
textLabel.numberOfLines = 3
108-
109-
imageView.translatesAutoresizingMaskIntoConstraints = false
110-
imageView.image = imageNamed("info").withRenderingMode(.alwaysTemplate)
111-
imageView.tintColor = .black
112-
113-
borderView.translatesAutoresizingMaskIntoConstraints = false
114-
borderView.backgroundColor = .clear
115-
borderView.layer.borderWidth = 2
116-
borderView.layer.cornerRadius = 10
117-
borderView.layer.borderColor = UIColor.black.cgColor
118-
}
119-
120101
// MARK: - State handling
121102

122103
private func handleStatusUpdate() {
@@ -126,12 +107,10 @@ public final class MessageViewController: UIViewController {
126107

127108
switch status.state {
128109
case .scanning, .unauthorized:
129-
textLabel.font = UIFont.boldSystemFont(ofSize: 14)
130110
textLabel.numberOfLines = 3
131111
textLabel.textAlignment = .left
132112
imageView.tintColor = regularTintColor
133113
case .processing:
134-
textLabel.font = UIFont.boldSystemFont(ofSize: 16)
135114
textLabel.numberOfLines = 10
136115
textLabel.textAlignment = .center
137116
borderView.isHidden = false
@@ -153,6 +132,37 @@ public final class MessageViewController: UIViewController {
153132
}
154133
}
155134

135+
// MARK: - Subviews factory
136+
137+
private extension MessageViewController {
138+
func makeTextLabel() -> UILabel {
139+
let label = UILabel()
140+
label.translatesAutoresizingMaskIntoConstraints = false
141+
label.textColor = .black
142+
label.numberOfLines = 3
143+
label.font = UIFont.boldSystemFont(ofSize: 14)
144+
return label
145+
}
146+
147+
func makeImageView() -> UIImageView {
148+
let imageView = UIImageView()
149+
imageView.translatesAutoresizingMaskIntoConstraints = false
150+
imageView.image = imageNamed("info").withRenderingMode(.alwaysTemplate)
151+
imageView.tintColor = .black
152+
return imageView
153+
}
154+
155+
func makeBorderView() -> UIView {
156+
let view = UIView()
157+
view.translatesAutoresizingMaskIntoConstraints = false
158+
view.backgroundColor = .clear
159+
view.layer.borderWidth = 2
160+
view.layer.cornerRadius = 10
161+
view.layer.borderColor = UIColor.black.cgColor
162+
return view
163+
}
164+
}
165+
156166
// MARK: - Layout
157167

158168
extension MessageViewController {

0 commit comments

Comments
 (0)