MSStickerBrowserViewController
A view controller that provides dynamic content to the standard sticker browser.
Declaration
class MSStickerBrowserViewControllerOverview
Use the MSStickerBrowserViewController to present the standard sticker browser. This browser provides drag-and-drop functionality. The user can press and hold a sticker to peel it from the browser, then drag the sticker to any balloon in the transcript. The user can also tap stickers to add them to the Messages app’s input field.
By default, the sticker browser view controller acts as the data source for its MSStickerBrowserView view (see the stickerBrowserView property). This lets you dynamically change the list of stickers at runtime. You can also customize the size of the stickers inside the browser.
Setting the Sticker Browser as Your Root View
To use the sticker browser view controller as your extension’s root view, perform the following steps:
Create a custom subclass of the MSStickerBrowserViewController class. For more information, see the subclassing notes.
In Interface Builder, add a container view to your extension’s initial scene and pin it to fill the root view as desired. For more information on setting up a container view, see Configuring a Container in Interface Builder.
In the Identity inspector, set the embedded view controller’s class to your custom MSStickerBrowserViewController subclass.
By using an MSMessagesAppViewController instance as the extension’s root view controller, this approach ensures that the root view controller can respond to important messages from the system, while the contained sticker browser view controller focuses on managing your stickers.
Subclassing Notes
By default, this controller sets itself as its sticker browser view’s data source. You must either provide another data source, or implement both numberOfStickers(in:) and stickerBrowserView(_:stickerAt:).
For more information, see MSStickerBrowserViewDataSource.