Skip to content

Commit

Permalink
Update usage of resources
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 28, 2024
1 parent e0c6a62 commit 95de1c4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Capabilities/Drawing/MediaEditorDrawing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MediaEditorDrawing: UIViewController {
static func initialize() -> MediaEditorDrawing {
return UIStoryboard(
name: "MediaEditorDrawing",
bundle: Bundle(for: MediaEditorDrawing.self)
bundle: mediaEditorBundle(for: MediaEditorDrawing.self)
).instantiateViewController(withIdentifier: "drawingViewController") as! MediaEditorDrawing
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Capabilities/Filters/MediaEditorFilters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class MediaEditorFilters: UIViewController {
static func initialize() -> MediaEditorFilters {
return UIStoryboard(
name: "MediaEditorFilters",
bundle: Bundle(for: MediaEditorFilters.self)
bundle: mediaEditorBundle(for: MediaEditorFilters.self)
).instantiateViewController(withIdentifier: "filtersViewController") as! MediaEditorFilters
}

Expand Down
8 changes: 8 additions & 0 deletions Sources/Extensions/Bundle+mediaEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ extension Bundle {
}
// Otherwise, the default bundle is used for resources
return defaultBundle
#endif
}

static func mediaEditorBundle(for type: AnyClass) -> Bundle? {
#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: type)
#endif
}
}
2 changes: 1 addition & 1 deletion Sources/MediaEditorHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public class MediaEditorHub: UIViewController {
}

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

private enum Constants {
Expand Down

0 comments on commit 95de1c4

Please sign in to comment.