Hello ! I'm trying to load an image from Assets.xc...
# ios
t
Hello ! I'm trying to load an image from Assets.xcassets into UIImage
val image = UIImage("mypin")
The file mypin.png is copied into Assets.xcassets in Xcode . This doesn't work , it fails to load the image. Anyone that has any thoughts on how to do this correctly?
r
Hello, are you using init(named: String) initializer?
t
No, not sure how I would use that ?
r
try something like
val image = UIImage(named: "mypin")
t
Ok, Tried that, but the only parameter accepting a String as input is "contentsOfFile:" . If i try
UIImage(named: "mypin")
it will not compile.
r
UIImage.imageNamed("mypin")
r
I thought he was using Swift 🙃
t
My bad, should have said it was Kotlin. @ribesg: Thank you !!