Learn how you can build your own custom sticker pack app for Messages, enabling you to fully control the behavior and appearance of the sticker browser.
I havenāt tried, so canāt help you Iām afraid.
Natasha The Robot has written something about how you can create an animated sticker with multiple images, which isnāt quite the same thing, but might be of interest:
They do work. Animated GIFs too, IIRC. I wouldnāt be surprised if XCode combines assets into an APNG under the hood when you create them in the editor.
@samdavies, I am getting an error trying to get the code as provided to run in Xcode:
for loadStickers() I get āuse of unresolved identifierā and for let url = Bundle.main().urlForResource(name, withExtension: āpngā)! I get āCannot call value of non-function type āBundleāā. How do I resolve this? Iām quite new to all of this, so any help is appreciated.
Is it possible to localise the stickers, with a local version of the image? Itās possible to localise the App Store resources, but Iām not sure how to handle the thorough localisation in the actual application.
Yes, @jasonnewell is right, you can add single images and stack them together, then Xcode provides the actual sequence as an animated version.
These issues are caused by changes in the API and the language in progressive Xcode betas. I recorded the messaging screencasts with some of the very first betas, and unfortunately things change. In Ī²6, Swift changed quite significantly. You now need something like:
let url = Bundle.main.url(forResource: name, withExtension: "png")
I think that Xcode should be able to suggest the fix required for this particular error - itās generally quite good at getting things updated.
The code for the equivalent chapter in the accompanying iOS 10 by Tutorials book will be up to date with the latest version of Xcode and Swift at the point that it is published, so you can check back there for working code.
Iām not sure whether itās possible to localise sticker images - sorry. I would think you could do it if you build your own custom sticker app, but that it might be more difficult if youāre just building a super-simple sticker pack app.
Iām still trying to figure out the āUse of unresolved identifier āloadStickersā.ā error that Xcode is throwing at me. Which way do I need to look? Thanks @samdavies
@samdavies, Sam, I have one last question for you regarding this tutorial. Which way do I need to look if I want to make the filter/stackview in the storyboard slide out of view as you slide down the stickers? In addition, how do I add elements below the stickerview at the very bottom, to, for instance say āThis is the end, expect new stickers soon. Here is my site {link}.ā
This is challenging because the sticker browser view already has some kind of scroll view behaviour. I would recommend using a collection view to hold your stickers instead (you can still use StickerView to display the stickers) and then you can add section headers and footers.
If I remember correctly, this is the approach that they took in one of the WWDC sessions on messaging apps - so I recommend you check them out.
You would need to create your own sticker pack app - like the one in this video (as opposed to a really simple sticker pack). Then you can use the same IAP APIs that you use in a full iOS app - itās all pretty much exactly the same.