Skip to content

Commit 114ec08

Browse files
committed
Add UIImage+Assets to test target, at the price of typesafe rsrc IDs
1 parent 19b6836 commit 114ec08

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

ios/MullvadVPN.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
06AC116228F94C450037AF9A /* ApplicationConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58BFA5CB22A7CE1F00A6173D /* ApplicationConfiguration.swift */; };
4444
44075DFB2CDA4F7400F61139 /* UDPOverTCPObfuscationSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44075DFA2CDA4F7400F61139 /* UDPOverTCPObfuscationSettingsViewModel.swift */; };
4545
440870822D7A00B70038972F /* UIImage+Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440870812D7A00B00038972F /* UIImage+Assets.swift */; };
46+
440870832D809B550038972F /* UIImage+Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440870812D7A00B00038972F /* UIImage+Assets.swift */; };
47+
440870842D809C980038972F /* UIImage+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = F062000B2CB7EB5D002E6DB9 /* UIImage+Helpers.swift */; };
4648
440E5AB02CDBD67D00B09614 /* StatefulPreviewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440E5AAF2CDBD67D00B09614 /* StatefulPreviewWrapper.swift */; };
4749
440E5AB42CDCF24500B09614 /* TunnelObfuscationSettingsWatchingObservableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 440E5AB32CDCF24500B09614 /* TunnelObfuscationSettingsWatchingObservableObject.swift */; };
4850
4419AA8B2D2826E5001B13C9 /* DetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4419AA8A2D2826E5001B13C9 /* DetailsView.swift */; };
@@ -5836,6 +5838,7 @@
58365838
A9A5F9F32ACB05160083449F /* AccountExpirySystemNotificationProvider.swift in Sources */,
58375839
A9A5F9F52ACB05160083449F /* NewDeviceNotificationProvider.swift in Sources */,
58385840
F09D04B72AE941DA003D4F89 /* OutgoingConnectionProxyTests.swift in Sources */,
5841+
440870832D809B550038972F /* UIImage+Assets.swift in Sources */,
58395842
F09D04B92AE95111003D4F89 /* OutgoingConnectionProxy.swift in Sources */,
58405843
7A6000F92B6273A4001CF0D9 /* AccessMethodViewModel.swift in Sources */,
58415844
7ABFB09E2BA316220074A49E /* RelayConstraintsTests.swift in Sources */,
@@ -5927,6 +5930,7 @@
59275930
44DD7D242B6CFFD70005F67F /* StartTunnelOperationTests.swift in Sources */,
59285931
44BB5F982BE527F4002520EB /* TunnelState+UI.swift in Sources */,
59295932
A9A5FA2B2ACB05160083449F /* CustomDateComponentsFormattingTests.swift in Sources */,
5933+
440870842D809C980038972F /* UIImage+Helpers.swift in Sources */,
59305934
A9A5FA2C2ACB05160083449F /* DeviceCheckOperationTests.swift in Sources */,
59315935
A9A5FA2D2ACB05160083449F /* DurationTests.swift in Sources */,
59325936
A9A5FA2E2ACB05160083449F /* FileCacheTests.swift in Sources */,

ios/MullvadVPN/Extensions/UIImage+Assets.swift

+20-20
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,44 @@ extension UIImage {
1212
enum Buttons {
1313
// Button images we expect as tightly cropped 24x24 images. The SVGs are 20x20 with a 2px border
1414
static var account: UIImage {
15-
UIImage(resource: .iconAccount).rescaled(by: 24 / 20)
15+
UIImage(named: "IconAccount")!.rescaled(by: 24 / 20)
1616
}
1717

1818
static var alert: UIImage {
19-
UIImage(resource: .iconAlert).rescaled(by: 24 / 20)
19+
UIImage(named: "IconAlert")!.rescaled(by: 24 / 20)
2020
}
2121

2222
static var info: UIImage {
2323
// the info icon was 18x18 cropped
24-
UIImage(resource: .iconInfo).resizeImage(targetSize: CGSize(width: 21.5, height: 21.5))
24+
UIImage(named: "IconInfo")!.resizeImage(targetSize: CGSize(width: 21.5, height: 21.5))
2525
}
2626

2727
static var settings: UIImage {
28-
UIImage(resource: .iconSettings).rescaled(by: 24 / 20)
28+
UIImage(named: "IconSettings")!.rescaled(by: 24 / 20)
2929
}
3030

3131
static var back: UIImage {
32-
UIImage(resource: .iconBack)
32+
UIImage(named: "IconBack")!
3333
}
3434

3535
static var copy: UIImage {
36-
UIImage(resource: .iconCopy)
36+
UIImage(named: "IconCopy")!
3737
}
3838

3939
static var hide: UIImage {
40-
UIImage(resource: .iconObscure)
40+
UIImage(named: "IconObscure")!
4141
}
4242

4343
static var reload: UIImage {
44-
UIImage(resource: .iconReload)
44+
UIImage(named: "IconReload")!
4545
}
4646

4747
static var rightArrow: UIImage {
48-
UIImage(resource: .iconArrow)
48+
UIImage(named: "IconArrow")!
4949
}
5050

5151
static var show: UIImage {
52-
UIImage(resource: .iconUnobscure)
52+
UIImage(named: "IconUnobscure")!
5353
}
5454

5555
// the close button, which comes we consume in two sizes, both of which come from the same asset
@@ -65,43 +65,43 @@ extension UIImage {
6565

6666
enum CellDecoration {
6767
static var chevronRight: UIImage {
68-
UIImage(resource: .iconChevron)
68+
UIImage(named: "IconChevron")!
6969
}
7070

7171
static var chevronDown: UIImage {
72-
UIImage(resource: .iconChevronDown)
72+
UIImage(named: "IconChevronDown")!
7373
}
7474

7575
static var chevronUp: UIImage {
76-
UIImage(resource: .iconChevronUp)
76+
UIImage(named: "IconChevronUp")!
7777
}
7878

7979
static var externalLink: UIImage {
80-
UIImage(resource: .iconExtlink)
80+
UIImage(named: "IconExtlink")!
8181
}
8282

8383
static var tick: UIImage {
84-
UIImage(resource: .iconTickSml)
84+
UIImage(named: "IconTickSml")!
8585
.resizeImage(targetSize: CGSize(width: 16, height: 16))
8686
}
8787
}
8888

8989
enum Status {
90-
static var failure: UIImage { UIImage(resource: .iconFail) }
91-
static var success: UIImage { UIImage(resource: .iconSuccess) }
90+
static var failure: UIImage { UIImage(named: "IconFail")! }
91+
static var success: UIImage { UIImage(named: "IconSuccess")! }
9292
}
9393

9494
// miscellaneous images
9595
static var backTransitionMask: UIImage {
96-
UIImage(resource: .iconBackTransitionMask)
96+
UIImage(named: "IconBackTransitionMask")!
9797
}
9898

9999
static var spinner: UIImage {
100-
UIImage(resource: .iconSpinner)
100+
UIImage(named: "IconSpinner")!
101101
}
102102

103103
static var tick: UIImage {
104-
UIImage(resource: .iconTickSml)
104+
UIImage(named: "IconTickSml")!
105105
.resizeImage(targetSize: CGSize(width: 24, height: 24))
106106
}
107107

0 commit comments

Comments
 (0)