Skip to content

Instantly share code, notes, and snippets.

@bartkozal
Created September 16, 2016 21:19
Show Gist options
  • Save bartkozal/e200e733e84b9e7b44125719b3b6e4a7 to your computer and use it in GitHub Desktop.
Save bartkozal/e200e733e84b9e7b44125719b3b6e4a7 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)"
var components = URLComponents()
let queryItem = URLQueryItem(name: "key", value: "value")
components.queryItems = [queryItem]
let message = MSMessage(session: session)
message.layout = layout
message.url = components.url
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