2

After creating a new "Augment Reality App" project in Xcode, I want to move art.scnassets folder from its default location to /Resources/ folder that I created. So the folder path would be like Resources/art.scnassets. However, it fails to load a png file in it if I move the folder. See below:

Before (working):

// art.scnassets folder is in its default place
// below code loads image.png
print(UIImage(named: "art.scnassets/image.png")!)

After (not working):

// moved folder to "Resources/art.scnassets"
// Resources folder is a group.
// below returns `nil`
print(UIImage(named: "Resources/art.scnassets/image.png")!)

I cleaned up the builds, and checked Copy Bundle Resources menu as well, but there is nothing wrong. If I move art.scnassets folder back to the project root, it works, meaning code works fine.

What should I do to move art.scnassets to somewhere else? I am new to Swift.

1 Answer 1

6

Have you tried using the first code?

print(UIImage(named: "art.scnassets/image.png")!)

As far as I know it doesn't matter in which folder the scnassets are, you can refer to it the same way.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.