Skip to content

Commit 35130fc

Browse files
Merge pull request #12 from plangrid/bgonzales/fix-translations
Update translations and images bundle
2 parents 8153edc + f89dbd4 commit 35130fc

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Sources/Helpers/Functions.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ import AVFoundation
77
- Returns: An image.
88
*/
99
func imageNamed(_ name: String) -> UIImage {
10-
let cls = BarcodeScannerViewController.self
11-
var bundle = Bundle(for: cls)
1210
let traitCollection = UITraitCollection(displayScale: 3)
1311

14-
if let resourceBundle = bundle.resourcePath.flatMap({ Bundle(path: $0 + "/BarcodeScanner.bundle") }) {
15-
bundle = resourceBundle
16-
}
17-
18-
guard let image = UIImage(named: name, in: bundle, compatibleWith: traitCollection) else {
12+
guard let image = UIImage(named: name, in: Bundle.module, compatibleWith: traitCollection) else {
1913
return UIImage()
2014
}
2115

@@ -28,11 +22,7 @@ func imageNamed(_ name: String) -> UIImage {
2822
- Returns: An image.
2923
*/
3024
func localizedString(_ key: String) -> String {
31-
if let path = Bundle(for: BarcodeScannerViewController.self).resourcePath,
32-
let resourceBundle = Bundle(path: path + "/Localization.bundle") {
33-
return resourceBundle.localizedString(forKey: key, value: nil, table: "Localizable")
34-
}
35-
return key
25+
return Bundle.module.localizedString(forKey: key, value: nil, table: "Localizable")
3626
}
3727

3828
/// Checks if the app is running in Simulator.

0 commit comments

Comments
 (0)