Skip to content

Instantly share code, notes, and snippets.

@bartkozal
Created September 16, 2016 21:13
Show Gist options
  • Save bartkozal/4b7d9f6a61d0aa698ff869475f36880d to your computer and use it in GitHub Desktop.
Save bartkozal/4b7d9f6a61d0aa698ff869475f36880d to your computer and use it in GitHub Desktop.
private func composeMessage() {
let conversation = activeConversation
let session = conversation?.selectedMessage?.session ?? MSSession()
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "message-background.png")
layout.imageTitle = "iMessage Extension"
layout.caption = "Hello world!"
layout.subcaption = "Sent by /(conversation?.localParticipantIdentifier)"
let message = MSMessage(session: session)
message.layout = layout
message.summaryText = "Sent Hello World message"
conversation?.insert(message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment