I have a sticker package Stickers.xcstickers
with a few stickers in it. I would like to programmatically get one of these stickers and put it in a MSStickerView
that I have in a UICollectionViewCell
. I know with a UIImage
it is easy and you can just do
let myImage = UIImage(named: "myImage.jpg")
Is there an equivalent to this with MSSticker?
let mySticker = MSSticker(named: "mySticker")
obviously does not work.
There is MSSticker(contentsOfFileURL: URL, localizedDescription: String
but I am unsure how to, if possible, properly implement in a similar fashion to UIImage.
Thanks.
No, there is not currently an equivalent. Moreover, you cannot programmatically create stickers from images in an asset catalog either, since those aren't accessible through file URL (pathForResource on the bundle won't generate a path for items in an .xcassets folder).
You need to go old school and drag the images in as a resource like you would any other file you were adding to the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With