Skip to content

Commit 6b5cc2b

Browse files
author
Mahdi
committed
<FIX> Ressources loading
1 parent daeab93 commit 6b5cc2b

7 files changed

Lines changed: 25 additions & 11 deletions

File tree

Example/.DS_Store

0 Bytes
Binary file not shown.

Example/Pods/Target Support Files/MBDocCapture/Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MBDocCapture.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'MBDocCapture'
3-
spec.version = '0.1.2'
3+
spec.version = '0.1.3'
44
spec.summary = 'MBDocCapture makes it easy to add document scanning functionalities to your iOS.'
55

66
spec.description = <<-DESC

MBDocCapture/Classes/ViewControllers/EditScanViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class EditScanViewController: UIViewController {
4949
}()
5050

5151
lazy private var nextButton: UIBarButtonItem = {
52-
let title = NSLocalizedString("mbdoccapture.next_button", tableName: nil, bundle: Bundle(for: EditScanViewController.self), value: "Next", comment: "")
52+
let title = NSLocalizedString("mbdoccapture.next_button", tableName: nil, bundle: bundle(), value: "Next", comment: "")
5353
let button = UIBarButtonItem(title: title, style: .plain, target: self, action: #selector(pushReviewController))
5454
button.tintColor = navigationController?.navigationBar.tintColor
5555
return button
@@ -83,7 +83,7 @@ final class EditScanViewController: UIViewController {
8383

8484
setupViews()
8585
setupConstraints()
86-
title = NSLocalizedString("mbdoccapture.scan_edit_title", tableName: nil, bundle: Bundle(for: EditScanViewController.self), value: "Trimming", comment: "")
86+
title = NSLocalizedString("mbdoccapture.scan_edit_title", tableName: nil, bundle: bundle(), value: "Trimming", comment: "")
8787
navigationItem.rightBarButtonItem = nextButton
8888

8989
zoomGestureController = ZoomGestureController(image: image, rectView: rectView)

MBDocCapture/Classes/ViewControllers/ImageScannerController.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,17 @@ public struct ImageScannerResults {
177177
public var detectedRectangle: Rectangle
178178

179179
}
180+
181+
extension UIViewController {
182+
183+
func bundle() -> Bundle {
184+
let frameworkBundle = Bundle(for: type(of: self))
185+
let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("MBDocCapture.bundle")
186+
187+
if let bundle = Bundle(url: bundleURL!) {
188+
return bundle
189+
} else {
190+
return Bundle(for: type(of: self))
191+
}
192+
}
193+
}

MBDocCapture/Classes/ViewControllers/ReviewViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ final class ReviewViewController: UIViewController {
4545
}()
4646

4747
lazy private var enhanceButton: UIBarButtonItem = {
48-
let image = UIImage(named: "enhance", in: Bundle(for: ReviewViewController.self), compatibleWith: nil)
48+
let image = UIImage(named: "enhance", in: bundle(), compatibleWith: nil)
4949
let button = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(toggleEnhancedImage))
5050
button.tintColor = .white
5151
return button
5252
}()
5353

5454
lazy private var rotateButton: UIBarButtonItem = {
55-
let image = UIImage(named: "rotate", in: Bundle(for: ReviewViewController.self), compatibleWith: nil)
55+
let image = UIImage(named: "rotate", in: bundle(), compatibleWith: nil)
5656
let button = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(rotateImage))
5757
button.tintColor = .white
5858
return button
5959
}()
6060

6161
lazy private var doneButton: UIBarButtonItem = {
62-
let title = NSLocalizedString("mbdoccapture.next_button", tableName: nil, bundle: Bundle(for: ReviewViewController.self), value: "Next", comment: "")
62+
let title = NSLocalizedString("mbdoccapture.next_button", tableName: nil, bundle: bundle(), value: "Next", comment: "")
6363
let button = UIBarButtonItem(title: title, style: .plain, target: self, action: #selector(finishScan))
6464
button.tintColor = navigationController?.navigationBar.tintColor
6565
return button
@@ -87,7 +87,7 @@ final class ReviewViewController: UIViewController {
8787
setupToolbar()
8888
setupConstraints()
8989

90-
title = NSLocalizedString("mbdoccapture.scan_review_title", tableName: nil, bundle: Bundle(for: ReviewViewController.self), value: "Confirmation", comment: "")
90+
title = NSLocalizedString("mbdoccapture.scan_review_title", tableName: nil, bundle: bundle(), value: "Confirmation", comment: "")
9191
navigationItem.rightBarButtonItem = doneButton
9292
}
9393

MBDocCapture/Classes/ViewControllers/ScannerViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class ScannerViewController: UIViewController {
6767
}
6868

6969
lazy private var cancelButton: UIBarButtonItem = {
70-
let title = NSLocalizedString("mbdoccapture.cancel_button", tableName: nil, bundle: Bundle(for: ScannerViewController.self), value: "Cancel", comment: "")
70+
let title = NSLocalizedString("mbdoccapture.cancel_button", tableName: nil, bundle: bundle(), value: "Cancel", comment: "")
7171
let button = UIBarButtonItem(title: title, style: .plain, target: self, action: #selector(cancelImageScannerController))
7272
button.tintColor = .white
7373
return button
@@ -337,7 +337,7 @@ extension ScannerViewController: RectangleDetectionDelegateProtocol {
337337
prepOverlayView.backgroundColor = UIColor(hexString: "FFFFFF99")
338338

339339
let image = UIImageView(frame: CGRect(x: (view.frame.width - 40) / 2, y: 16, width: 40, height: 40))
340-
let icon = UIImage(named: "ic_touch", in: Bundle(for: ScannerViewController.self), compatibleWith: nil)
340+
let icon = UIImage(named: "ic_touch", in: bundle(), compatibleWith: nil)
341341
image.image = icon
342342
prepOverlayView.addSubview(image)
343343

@@ -347,7 +347,7 @@ extension ScannerViewController: RectangleDetectionDelegateProtocol {
347347
label.numberOfLines = 0
348348
label.textColor = .black
349349
label.textAlignment = .center
350-
label.text = NSLocalizedString("mbdoccapture.document_capture_flip", tableName: nil, bundle: Bundle(for: EditScanViewController.self), value: "Flip your document and Touch the screen when you're ready to start the capture.", comment: "")
350+
label.text = NSLocalizedString("mbdoccapture.document_capture_flip", tableName: nil, bundle: bundle(), value: "Flip your document and Touch the screen when you're ready to start the capture.", comment: "")
351351
prepOverlayView.addSubview(label)
352352

353353
let button = UIButton(frame: view.bounds)

0 commit comments

Comments
 (0)