I am trying to get the path to an icon image which is part of the Xcode project, but without luck. I can create an image using the name, but i need the path.
let img = Bundle.main.path(forResource: "credit.jpg", ofType:"jpg")
let imm = UIImage(named: "credit.jpg")
I can see that img is nil but imm is not.
Any ideas?
Please Check this:
For Image Path:
let img = Bundle.main.path(forResource: "credit", ofType: "jpg")
print(img!)
For Image Url:
let img = Bundle.main.url(forResource: "credit", withExtension: "jpg")
print(img!)