Hi!
I'm using R.validate() in a submodule test case and it throws an exception due to a missing UIImage in storyboard. If I launch my app and I go to the controller with that "missing" UIImage, the app does not crash and shows correctly that UIImage.
Maybe should I declare the host bundle in some place (like storyboard?) or something?
Would you be able to provide us with a reproduction sample? Then we can look into this and fix it. If a sample app is too much work it would be nice to know:
validate() method by R.swift for this image?Thank you for replying me. I have created a sample app with a submodule, using cocoapods. There are two unit tests checking if all images in storyboards are correctly loaded, by calling R.validate().
If you run the app, you can see all images are correctly visible. But if you test the app, the Submodule unit test fails, because of ic_code is missing from the bundle.
same problem: https://twitter.com/Cooler333/status/1052508604266409984
struct someSome: Rswift.StoryboardResourceWithInitialControllerType, Rswift.Validatable {
typealias InitialController = SOMESome
let bundle = R.hostingBundle // unused
let name = "SOMESome" // unused too, but it's minor issue
static func validate() throws {
if UIKit.UIImage(named: "some_some" /*, in: bundle*/ ) == nil { throw Rswift.ValidationError(description: "[R.swift] Image named 'some_some' is used in storyboard 'SOMESome', but couldn't be loaded.") }
}
fileprivate init() {}
}
UIImage missing argument for bundle
@available(iOS 8.0, *)
public /*not inherited*/ init?(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?)
but used
public /*not inherited*/ init?(named name: String) // load from main bundle
This also affects named colors, the solution would be the same, to use the bundle parameter with the value of R.hostingBundle
@rolandkakonyi add fix for colors in PR :)
This should be fix as of 5.0.0.alpha.3
Most helpful comment
same problem: https://twitter.com/Cooler333/status/1052508604266409984
UIImage missing argument for bundle
but used