Skip to content

Commit 1f67f8e

Browse files
committed
Fix functions
1 parent 05292f1 commit 1f67f8e

File tree

8 files changed

+4
-13
lines changed

8 files changed

+4
-13
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version:5.3
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "BarcodeScanner",
8+
defaultLocalization: "en",
89
platforms: [.iOS(.v10)],
910
products: [
1011
// Products define the executables and libraries produced by a package, and make them visible to other packages.

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+
NSLocalizedString(key, bundle: Bundle.module, comment: key)
3626
}
3727

3828
/// Checks if the app is running in Simulator.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)