{"id":20519462,"url":"https://github.com/sahin/iMessageDataKit","last_synced_at":"2025-05-09T09:31:23.151Z","repository":{"id":56932281,"uuid":"106874022","full_name":"sahin/iMessageDataKit","owner":"sahin","description":"Store custom data as key-value pairs in MSMessage objects.","archived":false,"fork":false,"pushed_at":"2017-10-14T13:48:37.000Z","size":116,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T12:43:54.223Z","etag":null,"topics":["imessage","imessage-apps","imessage-extensions","imessage-stickers","ios","messages","msmessage","swift3","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sahin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-13T21:14:54.000Z","updated_at":"2025-03-10T11:30:36.000Z","dependencies_parsed_at":"2022-08-21T05:50:36.238Z","dependency_job_id":null,"html_url":"https://github.com/sahin/iMessageDataKit","commit_stats":null,"previous_names":["svtek/imessagedatakit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahin%2FiMessageDataKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahin%2FiMessageDataKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahin%2FiMessageDataKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sahin%2FiMessageDataKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sahin","download_url":"https://codeload.github.com/sahin/iMessageDataKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253226467,"owners_count":21874333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imessage","imessage-apps","imessage-extensions","imessage-stickers","ios","messages","msmessage","swift3","xcode"],"created_at":"2024-11-15T22:14:04.959Z","updated_at":"2025-05-09T09:31:22.837Z","avatar_url":"https://github.com/sahin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./iMessageDataKitBanner.jpg\" alt=\"iMessageDataKit\" /\u003e\n\n[![iOS 10 +](https://img.shields.io/badge/iOS-10%2B-brightgreen.svg)](https://github.com/svtek)\n\nStore custom data as key-value pairs in `MSMessage` objects.\n\n## Contents\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Quick Start](#quick-start)\n    - [How it works](#how-it-works)\n    - [Resources](#resources)\n- [Idea](#idea)\n- [Author](#author)\n- [License](#license)\n\n## Requirements\n\n- iOS 10+\n- Swift 3\n- Messages.framework\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate `iMessageDataKit` into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'iMessageDataKit'\n```\n\nThen, run the following command in Terminal (from your project's root folder):\n\n```bash\n$ pod install\n```\n\n### Manual\n\nDrag \u0026 drop `Source` folder into your Xcode project.\n\n---\n\n## Usage\n\n`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.\n\n### Quick Start\n\n```swift\nimport Messages\nimport iMessageDataKit\n\nclass MessagesViewController: MSMessagesAppViewController {\n\n  // ...\n\n  func sendMessage() {\n\n    let layout = MSMessageTemplateLayout()\n    layout.caption = \"A message with custom data.\"\n\n    let message: MSMessage = MSMessage()\n    message.layout = layout\n\n    //\n    // set custom data\n    //\n    message.md.set(value: 7, forKey: \"user_id\")\n    message.md.set(value: Int(NSDate().timeIntervalSince1970), forKey: \"timestamp\")\n    message.md.set(value: true, forKey: \"is_okay\")\n    message.md.set(value: \"john\", forKey: \"username\")\n    message.md.set(values: [\"happy\", \"joy\", \"smile\"], forKey: \"tags\")\n    message.md.set(values: [7.3, 5.2], forKey: \"dimensions\")\n\n    //\n    // send or insert message to activeConversation ...\n    //\n  }\n\n  override func didSelect(_ message: MSMessage, conversation: MSConversation) {\n\n    //\n    // access selected message's custom data\n    //\n\n    if let userId = message.md.integer(forKey: \"user_id\") {\n      // do sth with userId\n    }\n\n    if let timestamp = message.md.integer(forKey: \"timestamp\") {\n      // do sth with timestamp\n    }\n\n    if let isOkay = message.md.bool(forKey: \"is_okay\") {\n      // do sth with isOkay\n    }\n\n    if let username = message.md.string(forKey: \"username\") {\n      // do sth with username\n    }\n\n    if let tags = message.md.values(forKey: \"tags\") {\n      // do sth with tags array\n    }\n\n    if let dimensions = message.md.values(forKey: \"dimensions\") {\n      // do sth with dimensions array\n    }\n  }\n\n  // ...\n\n}\n```\n\n### How it works\niMessageDataKit encodes/decodes data as JSON and utilizes `url` property of `MSMessage` class to store encoded JSON string as a querystring.\n\n### Resources\n- [Messages.framework](https://developer.apple.com/documentation/messages)\n- [MSMessage](https://developer.apple.com/documentation/messages/msmessage)\n\n## Idea\n- Sahin Boydas ([@sahinboydas](https://twitter.com/sahinboydas))\n\n## Author\n- Ahmet Ardal ([@ardalahmet](https://github.com/ardalahmet/))\n\n## License\niMessageDataKit is released under the MIT license. See LICENSE for details or visit http://www.apache.org/licenses/LICENSE-2.0 for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahin%2FiMessageDataKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsahin%2FiMessageDataKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsahin%2FiMessageDataKit/lists"}