@@ -142,21 +142,25 @@ extension CFNotifyView {
142
142
}
143
143
144
144
static func setClassicThemeFor( view: ClassicView , theme: Theme ) {
145
+ let frameworkBundle = Bundle ( for: CFNotifyView . self)
146
+ let bundleURL = frameworkBundle. resourceURL? . appendingPathComponent ( " CFResources.bundle " )
147
+ let resourceBundle = Bundle ( url: bundleURL!)
148
+
145
149
switch theme {
146
150
case . Success( let style) :
147
151
switch style {
148
152
case . Light:
149
153
view. backgroundColor = UIColor ( red: 65.0 / 256.0 , green: 131.0 / 256.0 , blue: 215.0 / 256.0 , alpha: 1.0 )
150
154
view. titleTextColor = UIColor . white
151
155
view. bodyTextColor = UIColor . white
152
- let image = UIImage ( named: " CFResources.bundle/ icon_success" ) ? . withRenderingMode ( . alwaysTemplate)
156
+ let image = UIImage ( named: " icon_success " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
153
157
view. imageView. image = image
154
158
view. imageView. tintColor = UIColor . white
155
159
case . Dark:
156
160
view. backgroundColor = UIColor ( red: 31.0 / 256.0 , green: 58.0 / 256.0 , blue: 147.0 / 256.0 , alpha: 1.0 )
157
161
view. titleTextColor = UIColor . white
158
162
view. bodyTextColor = UIColor . white
159
- let image = UIImage ( named: " CFResources.bundle/ icon_success_dark" ) ? . withRenderingMode ( . alwaysTemplate)
163
+ let image = UIImage ( named: " icon_success_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
160
164
view. imageView. image = image
161
165
view. imageView. tintColor = UIColor . white
162
166
}
@@ -166,14 +170,14 @@ extension CFNotifyView {
166
170
view. backgroundColor = UIColor ( red: 231.0 / 256.0 , green: 76.0 / 256.0 , blue: 60.0 / 256.0 , alpha: 1.0 )
167
171
view. titleTextColor = UIColor . white
168
172
view. bodyTextColor = UIColor . white
169
- let image = UIImage ( named: " CFResources.bundle/ icon_fail" ) ? . withRenderingMode ( . alwaysTemplate)
173
+ let image = UIImage ( named: " icon_fail " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
170
174
view. imageView. image = image
171
175
view. imageView. tintColor = UIColor . white
172
176
case . Dark:
173
177
view. backgroundColor = UIColor ( red: 185.0 / 256.0 , green: 29.0 / 256.0 , blue: 71.0 / 256.0 , alpha: 1.0 )
174
178
view. titleTextColor = UIColor . white
175
179
view. bodyTextColor = UIColor . white
176
- let image = UIImage ( named: " CFResources.bundle/ icon_fail_dark" ) ? . withRenderingMode ( . alwaysTemplate)
180
+ let image = UIImage ( named: " icon_fail_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
177
181
view. imageView. image = image
178
182
view. imageView. tintColor = UIColor . white
179
183
}
@@ -183,14 +187,14 @@ extension CFNotifyView {
183
187
view. backgroundColor = UIColor ( red: 191.0 / 256.0 , green: 191.0 / 256.0 , blue: 191.0 / 256.0 , alpha: 1.0 )
184
188
view. titleTextColor = UIColor . white
185
189
view. bodyTextColor = UIColor . white
186
- let image = UIImage ( named: " CFResources.bundle/ icon_info" ) ? . withRenderingMode ( . alwaysTemplate)
190
+ let image = UIImage ( named: " icon_info " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
187
191
view. imageView. image = image
188
192
view. imageView. tintColor = UIColor . white
189
193
case . Dark:
190
194
view. backgroundColor = UIColor ( red: 29.0 / 256.0 , green: 29.0 / 256.0 , blue: 29.0 / 256.0 , alpha: 1.0 )
191
195
view. titleTextColor = UIColor . white
192
196
view. bodyTextColor = UIColor . white
193
- let image = UIImage ( named: " CFResources.bundle/ icon_info_dark" ) ? . withRenderingMode ( . alwaysTemplate)
197
+ let image = UIImage ( named: " icon_info_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
194
198
view. imageView. image = image
195
199
view. imageView. tintColor = UIColor . white
196
200
}
@@ -200,35 +204,39 @@ extension CFNotifyView {
200
204
view. backgroundColor = UIColor ( red: 245.0 / 256.0 , green: 171.0 / 256.0 , blue: 53.0 / 256.0 , alpha: 1.0 )
201
205
view. titleTextColor = UIColor . white
202
206
view. bodyTextColor = UIColor . white
203
- let image = UIImage ( named: " CFResources.bundle/ icon_warning" ) ? . withRenderingMode ( . alwaysTemplate)
207
+ let image = UIImage ( named: " icon_warning " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
204
208
view. imageView. image = image
205
209
view. imageView. tintColor = UIColor . white
206
210
case . Dark:
207
211
view. backgroundColor = UIColor ( red: 218.0 / 256.0 , green: 83.0 / 256.0 , blue: 44.0 / 256.0 , alpha: 1.0 )
208
212
view. titleTextColor = UIColor . white
209
213
view. bodyTextColor = UIColor . white
210
- let image = UIImage ( named: " CFResources.bundle/ icon_warning_dark" ) ? . withRenderingMode ( . alwaysTemplate)
214
+ let image = UIImage ( named: " icon_warning_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
211
215
view. imageView. image = image
212
216
view. imageView. tintColor = UIColor . white
213
217
}
214
218
}
215
219
}
216
220
217
221
static func setCyberThemeFor( view: CyberView , theme: Theme ) {
222
+ let frameworkBundle = Bundle ( for: CFNotifyView . self)
223
+ let bundleURL = frameworkBundle. resourceURL? . appendingPathComponent ( " CFResources.bundle " )
224
+ let resourceBundle = Bundle ( url: bundleURL!)
225
+
218
226
switch theme {
219
227
case . Success( let style) :
220
228
switch style {
221
229
case . Light:
222
230
view. backgroundColor = UIColor ( red: 65.0 / 256.0 , green: 131.0 / 256.0 , blue: 215.0 / 256.0 , alpha: 0.5 )
223
231
view. titleTextColor = UIColor . white
224
232
view. bodyTextColor = UIColor . white
225
- let image = UIImage ( named: " CFResources.bundle/ icon_success" ) ? . withRenderingMode ( . alwaysTemplate)
233
+ let image = UIImage ( named: " icon_success " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
226
234
view. imageView. image = image
227
235
case . Dark:
228
236
view. backgroundColor = UIColor ( red: 31.0 / 256.0 , green: 58.0 / 256.0 , blue: 147.0 / 256.0 , alpha: 0.5 )
229
237
view. titleTextColor = UIColor . white
230
238
view. bodyTextColor = UIColor . white
231
- let image = UIImage ( named: " CFResources.bundle/ icon_success_dark" ) ? . withRenderingMode ( . alwaysTemplate)
239
+ let image = UIImage ( named: " icon_success_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
232
240
view. imageView. image = image
233
241
}
234
242
case . Fail( let style) :
@@ -237,13 +245,13 @@ extension CFNotifyView {
237
245
view. backgroundColor = UIColor ( red: 231.0 / 256.0 , green: 76.0 / 256.0 , blue: 60.0 / 256.0 , alpha: 0.5 )
238
246
view. titleTextColor = UIColor . white
239
247
view. bodyTextColor = UIColor . white
240
- let image = UIImage ( named: " CFResources.bundle/ icon_fail" ) ? . withRenderingMode ( . alwaysTemplate)
248
+ let image = UIImage ( named: " icon_fail " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
241
249
view. imageView. image = image
242
250
case . Dark:
243
251
view. backgroundColor = UIColor ( red: 185.0 / 256.0 , green: 29.0 / 256.0 , blue: 71.0 / 256.0 , alpha: 0.5 )
244
252
view. titleTextColor = UIColor . white
245
253
view. bodyTextColor = UIColor . white
246
- let image = UIImage ( named: " CFResources.bundle/ icon_fail_dark" ) ? . withRenderingMode ( . alwaysTemplate)
254
+ let image = UIImage ( named: " icon_fail_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
247
255
view. imageView. image = image
248
256
}
249
257
case . Info( let style) :
@@ -252,13 +260,13 @@ extension CFNotifyView {
252
260
view. backgroundColor = UIColor ( red: 191.0 / 256.0 , green: 191.0 / 256.0 , blue: 191.0 / 256.0 , alpha: 0.5 )
253
261
view. titleTextColor = UIColor . white
254
262
view. bodyTextColor = UIColor . white
255
- let image = UIImage ( named: " CFResources.bundle/ icon_info" ) ? . withRenderingMode ( . alwaysTemplate)
263
+ let image = UIImage ( named: " icon_info " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
256
264
view. imageView. image = image
257
265
case . Dark:
258
266
view. backgroundColor = UIColor ( red: 29.0 / 256.0 , green: 29.0 / 256.0 , blue: 29.0 / 256.0 , alpha: 0.5 )
259
267
view. titleTextColor = UIColor . white
260
268
view. bodyTextColor = UIColor . white
261
- let image = UIImage ( named: " CFResources.bundle/ icon_info_dark" ) ? . withRenderingMode ( . alwaysTemplate)
269
+ let image = UIImage ( named: " icon_info_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
262
270
view. imageView. image = image
263
271
}
264
272
case . Warning( let style) :
@@ -267,13 +275,13 @@ extension CFNotifyView {
267
275
view. backgroundColor = UIColor ( red: 245.0 / 256.0 , green: 171.0 / 256.0 , blue: 53.0 / 256.0 , alpha: 0.5 )
268
276
view. titleTextColor = UIColor . white
269
277
view. bodyTextColor = UIColor . white
270
- let image = UIImage ( named: " CFResources.bundle/ icon_warning" ) ? . withRenderingMode ( . alwaysTemplate)
278
+ let image = UIImage ( named: " icon_warning " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
271
279
view. imageView. image = image
272
280
case . Dark:
273
281
view. backgroundColor = UIColor ( red: 218.0 / 256.0 , green: 83.0 / 256.0 , blue: 44.0 / 256.0 , alpha: 0.5 )
274
282
view. titleTextColor = UIColor . white
275
283
view. bodyTextColor = UIColor . white
276
- let image = UIImage ( named: " CFResources.bundle/ icon_warning_dark" ) ? . withRenderingMode ( . alwaysTemplate)
284
+ let image = UIImage ( named: " icon_warning_dark " , in : resourceBundle , compatibleWith : nil ) ? . withRenderingMode ( . alwaysTemplate)
277
285
view. imageView. image = image
278
286
view. imageView. tintColor = UIColor . white
279
287
}
0 commit comments