Describe the bug
When integrating via Cocoapods (using the new resource bundles), SwiftTweaks crashes when navigating to a sub-menu.
To Reproduce
Steps to reproduce the behavior:
- Integrate SwiftTweaks through Cocoapods
- Run the app and open the SwiftTweaks menu
- Navigate to a submenu
- Notice the crash
Expected behavior
The submenu is displayed.
Additional context
The code that's causing the issue in question is the following:
// NOTE (bryan): if we just used UIImage(named:_), we get crashes when running in other apps!
// (Why? Because by default, iOS searches in your app's bundle, but we need to redirect that to the bundle associated with SwiftTweaks
private convenience init?(inThisBundleNamed imageName: String) {
#if SWIFT_PACKAGE
self.init(named: imageName, in: Bundle.module, compatibleWith: nil)
#else
self.init(named: imageName, in: Bundle(for: TweakTableCell.self), compatibleWith: nil) // NOTE (bryan): Could've used any class in SwiftTweaks here.
#endif
}
Note that because the resource bundle now is a named bundle and not directly part of the SwiftTweaks framework itself, Bundle(for: TweakTableCell.self) will no longer work. This should be updated to reference the new resource bundle directly, though this might also impact other integrations.
Describe the bug
When integrating via Cocoapods (using the new resource bundles), SwiftTweaks crashes when navigating to a sub-menu.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The submenu is displayed.
Additional context
The code that's causing the issue in question is the following:
Note that because the resource bundle now is a named bundle and not directly part of the SwiftTweaks framework itself, Bundle(for: TweakTableCell.self) will no longer work. This should be updated to reference the new resource bundle directly, though this might also impact other integrations.