Skip to content

Commit 95de1c4

Browse files
committed
Update usage of resources
1 parent e0c6a62 commit 95de1c4

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Sources/Capabilities/Drawing/MediaEditorDrawing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MediaEditorDrawing: UIViewController {
2020
static func initialize() -> MediaEditorDrawing {
2121
return UIStoryboard(
2222
name: "MediaEditorDrawing",
23-
bundle: Bundle(for: MediaEditorDrawing.self)
23+
bundle: mediaEditorBundle(for: MediaEditorDrawing.self)
2424
).instantiateViewController(withIdentifier: "drawingViewController") as! MediaEditorDrawing
2525
}
2626

Sources/Capabilities/Filters/MediaEditorFilters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class MediaEditorFilters: UIViewController {
120120
static func initialize() -> MediaEditorFilters {
121121
return UIStoryboard(
122122
name: "MediaEditorFilters",
123-
bundle: Bundle(for: MediaEditorFilters.self)
123+
bundle: mediaEditorBundle(for: MediaEditorFilters.self)
124124
).instantiateViewController(withIdentifier: "filtersViewController") as! MediaEditorFilters
125125
}
126126

Sources/Extensions/Bundle+mediaEditor.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ extension Bundle {
1313
}
1414
// Otherwise, the default bundle is used for resources
1515
return defaultBundle
16+
#endif
17+
}
18+
19+
static func mediaEditorBundle(for type: AnyClass) -> Bundle? {
20+
#if SWIFT_PACKAGE
21+
return Bundle.module
22+
#else
23+
return Bundle(for: type)
1624
#endif
1725
}
1826
}

Sources/MediaEditorHub.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public class MediaEditorHub: UIViewController {
253253
}
254254

255255
static func initialize() -> MediaEditorHub {
256-
return UIStoryboard(name: "MediaEditorHub", bundle: Bundle(for: MediaEditorHub.self)).instantiateViewController(withIdentifier: "hubViewController") as! MediaEditorHub
256+
return UIStoryboard(name: "MediaEditorHub", bundle: .mediaEditorBundle(for: MediaEditorHub.self)).instantiateViewController(withIdentifier: "hubViewController") as! MediaEditorHub
257257
}
258258

259259
private enum Constants {

0 commit comments

Comments
 (0)