Basic Sticker Extension using Messages SDK - iMessage App Extension

Message App Extensions

When bots and stickers are already available in most popular messaging apps, Apple has brought the native iMessage applications to the competition. Now developers can create app extensions, which can be part of existing apps or an individual extension which would be available in iMessage App Store. This iMessage App store is completely different from regular App Store.


Using app extensions, Apple will allow its developers to create basic sticker packs, custom sticker applications and custom applications.


Before we jump into the whole coding thing, let's have a quick look at app extensions.


App Extension


An app extension allows the developers to extend the custom functionality and contents beyond the application while the users are interacting with other apps or system.


For example, a Today widget is a great extension to view the information even though the users are using any app.


An app extension is a separate binary that runs independent of the app.


Prerequisites

To develop a message extension, you need to run XCode 8 (Currently available in beta) on El Capitan or Sierra (currently in beta) version.


Basic Sticker Packs


Message apps will become more fun with sticker options. Having amazing designers in the world, Apple really wanted designers to contribute to Message ecosystem.


To make this possible, Apple has provided guidelines for creating the stickers. Even though coding is not required to create this extension, it do require to create images.


Talking about guidelines,


- The image must be PNG, APNG, GIF and JPEG file.
- The file size should be less than 500 kb.


For better display of images, Apple recommends to scale images in the below range.



Minimum Maximum
Small 100 x 100 300 x 300
Medium 136 x 136 378 x 378
Large 206 x 206 618 x 618


Let’s create few images and prepare out sticker pack. The images will be uploaded along with this project. So you can reuse it to play around.



1. Launch XCode 8






    2. Create a new iOS extension application, Choose XCode -> New -> Project




    3. XCode will now open the available template options. Select Sticker Pack Application template

    4. Enter your project name. For this demo purpose, I have created a project, IconFinder. There is no option to select the language, since no coding is involved in this process. Click Next.



    5. XCode will prompt to select the location to save the project. Choose a location of your choice.

    6. Now, the project is created. You can observer the project has only one blue coloured folder, Stickers.xcstickers file. This is the Assets folder for this project. Assets folder makes easy to maintain the graphics for different scale like @2x and @3x and also for different devices like iPhone and iPad.



    7. Choose Stickers.xcstickers. Drag and drop the created stickers to the center white area. Now you can see the images are created as files.

    8. Click on the Inspector panel. Select the Sticker Size to Small. This option is related to Sticker image size created by you. For this demo project, I created all the images in size, 100 * 100. So I define my sticker size setting to Small. Do change your settings appropriately.



    9. Build and Run the project. You can press CMD + R keys.

    10. Starting from XCode 8, Message apps are now built-in to Simulators. Launch Message apps.

    11. You will see a new conversation is opened. Next to text field, you will now see 3 new buttons.

    12. First button is to open Camera/Photo gallery. Second button is to write hand written messages. Third button is to open iMessage App Store. Tap on the third button.



    13. iMessage App Store will now show our IconFinder app. Tap on IconFinder app.

    14. The created Stickers will be shown. Tap on any sticker.



    15. Type your custom message and click on the Arrow button to send the message.





    Finally, we are able to create an app extension without a single line of code for iMessage app. Apple made it easy for developers to test on simulator by providing both the end conversation on same simulator. So no need to switch device to check the messages.



    We will dive more in detail about how to create a app extension application for iMessage app store in following articles.

    The source code is available for downloaded from github.


    Follow me on Twitter @mcabasheer


    Comments

    Popular posts from this blog

    Integrating ZXing QR Code reader in iPhone / iOS applications

    Multiple line of text in UIPickerView

    Connect Samsung devices to Kies on Mac