Skip to content

Commit 0aec18c

Browse files
committed
Add dedicated accessor for Bundle
1 parent af33de7 commit 0aec18c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Foundation
2+
3+
extension Bundle {
4+
static var hardware: Bundle {
5+
#if DEBUG
6+
// Workaround for https://forums.swift.org/t/swift-5-3-swiftpm-resources-in-tests-uses-wrong-bundle-path/37051
7+
if let testBundlePath = ProcessInfo.processInfo.environment["XCTestBundlePath"],
8+
let bundle = Bundle(path: "\(testBundlePath)/Modules_Hardware.bundle") {
9+
return bundle
10+
}
11+
#endif
12+
return Bundle.module
13+
14+
}
15+
}

Modules/Sources/Hardware/CardReader/CardBrand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import Foundation
3737
extension CardBrand {
3838

3939
private var iconURL: URL! {
40-
Bundle.module.url(forResource: iconName, withExtension: "svg")
40+
Bundle.hardware.url(forResource: iconName, withExtension: "svg")
4141
}
4242

4343
/// Icon that represents the brand in SVG format

0 commit comments

Comments
 (0)