Latest 0.1.0
License MIT
Platforms ios 10.0
Frameworks Messages


iOS 10 +

Store custom data as key-value pairs in MSMessage objects.



  • iOS 10+
  • Swift 3
  • Messages.framework



CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate iMessageDataKit into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'iMessageDataKit'

Then, run the following command in Terminal (from your project’s root folder):

$ pod install


Drag & drop Source folder into your Xcode project.


iMessageDataKit extension methods enable you to use an MSMessage object as a dictionary-like key-value store. You can set/get Int, Bool, Float, Double, String and Array values. Arrays should contain objects that conform to LosslessStringConvertible protocol.

Quick Start

import Messages
import iMessageDataKit

class MessagesViewController: MSMessagesAppViewController {

  // ...

  func sendMessage() {

    let layout = MSMessageTemplateLayout()
    layout.caption = "A message with custom data."

    let message: MSMessage = MSMessage()
    message.layout = layout

    // set custom data
    // 7, forKey: "user_id") Int(NSDate().timeIntervalSince1970), forKey: "timestamp") true, forKey: "is_okay") "john", forKey: "username") ["happy", "joy", "smile"], forKey: "tags") [7.3, 5.2], forKey: "dimensions")

    // send or insert message to activeConversation ...

  override func didSelect(_ message: MSMessage, conversation: MSConversation) {

    // access selected message's custom data

    if let userId = "user_id") {
      // do sth with userId

    if let timestamp = "timestamp") {
      // do sth with timestamp

    if let isOkay = "is_okay") {
      // do sth with isOkay

    if let username = "username") {
      // do sth with username

    if let tags = "tags") {
      // do sth with tags array

    if let dimensions = "dimensions") {
      // do sth with dimensions array

  // ...


How it works

iMessageDataKit encodes/decodes data as JSON and utilizes url property of MSMessage class to store encoded JSON string as a querystring.





iMessageDataKit is released under the MIT license. See LICENSE for details or visit for more information.

Latest podspec

    "name": "iMessageDataKit",
    "version": "0.1.0",
    "summary": "Store custom data as key-value pairs in MSMessage objects.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Ahmet Ardal": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "social_media_url": "",
    "platforms": {
        "ios": "10.0"
    "source_files": "Source/iMessageDataKit/*.swift",
    "frameworks": "Messages",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This