This chapter has mostly focused on user interface-related aspects of iMessage apps. When you create an iMessage app, your app will sooner or later have to send a message. To do this, you use the MSMessage
and MSSession
objects. In addition to messages and sessions, the MSConversation
class represents the conversation context that your extension exists in. These three classes together allow you to send messages, identify recipients in conversations, and even update or collapse existing messages in the messages transcript.
When an iMessage extension is activated, willBecomeActive(with:)
is called in MessagesViewController
. This method receives an instance of MSConversation
that you can use to send messages, stickers, and even attachments. More importantly, the conversation contains unique identifiers for participants in the conversation and the currently selected message.
The localParticipantIdentifier
and remoteParticipantIdentifier
properties...