0

I am doing a loop through my .launchimage images, in order to re-use the one I need in a different context, but when I do so, most of the UIImage return nil, like with AppLoginLaunchImage.launchimage/LaunchImage-Landscape~ipad_1024x768.png.

Image with name AppLoginLaunchImage.launchimage/LaunchImage.png works however. Why is that and what can I do to get all objects from my assets? ?

let allPngImageNames = Bundle.main.paths(forResourcesOfType: "png", inDirectory: "AppLoginLaunchImage.launchimage")

for imageName in allPngImageNames{
       
        //guard let image = UIImage(named: imageName) else { continue }
        let image = UIImage(named: imageName)
        if (image == nil) {
            continue
        }
michaelsmith
  • 1,011
  • 1
  • 16
  • 35

1 Answers1

0

Is that a typo or are you missing a closing curly bracket?

Timmy Mi
  • 33
  • 7