{"id":15527887,"url":"https://github.com/mergesort/communicado","last_synced_at":"2025-04-23T12:31:05.528Z","repository":{"id":56906418,"uuid":"51563596","full_name":"mergesort/Communicado","owner":"mergesort","description":"A simpler way to share on iOS.","archived":false,"fork":false,"pushed_at":"2020-01-19T21:29:59.000Z","size":7817,"stargazers_count":26,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T19:26:10.542Z","etag":null,"topics":["ios","sharing"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mergesort.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-02-12T02:50:23.000Z","updated_at":"2021-12-11T15:38:51.000Z","dependencies_parsed_at":"2022-08-21T03:20:54.788Z","dependency_job_id":null,"html_url":"https://github.com/mergesort/Communicado","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergesort%2FCommunicado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergesort%2FCommunicado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergesort%2FCommunicado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mergesort%2FCommunicado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mergesort","download_url":"https://codeload.github.com/mergesort/Communicado/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250434626,"owners_count":21430138,"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":["ios","sharing"],"created_at":"2024-10-02T11:09:45.518Z","updated_at":"2025-04-23T12:31:05.482Z","avatar_url":"https://github.com/mergesort.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Communicado\n\n### Sharing on iOS made easy.\n\n[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=59b695f696d4600001f5144a\u0026branch=master\u0026build=latest)](https://dashboard.buddybuild.com/apps/59b695f696d4600001f5144a/build/latest?branch=master)\n[![Pod Version](https://img.shields.io/badge/Pod-3.2.0-6193DF.svg)](https://cocoapods.org/)\n![Swift Version](https://img.shields.io/badge/Swift-5.1-brightgreen.svg)\n![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg) \n![Plaform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)\n\n---\n\n#### Are you tired of rewriting the same sharing code over and over again?\n\n![](Images/cartman.gif)\n#### Me too!\n\n![](Images/homer.gif)\n#### That's why I wrote Communicado! Let's show you how it's done.\n\nSharing\n---\n\nThe first thing to know is can share from any `UIViewController` that conforms to `SharingCapableViewController`. Once you add this, you will get a `share` function on `UIViewController` which supports many built in sharing types.\n\nYou can share to:\n\n- Messages\n- Mail\n- Pasteboard\n- Photos\n- UIActivityController\n- Twitter (iOS 10.3 and lower)\n- Facebook (iOS 10.3 and lower)\n- Sina Weibo (iOS 10.3 and lower)\n- Tencent Weibo (iOS 10.3 and lower)\n\nEach sharing destination takes in parameters. Let's try a simple example.\n\n```swift\nlet heartImageData = UIImagePNGRepresentation(myHeartImage)\nlet attachment = Attachment(attachmentType: AttachmentType.png, filename: \"heart.png\", data: heartImageData)\nlet messageParameters = MessageShareParameters(message: \"I ❤️ Communicado\", attachments: [ attachment ])\n```\n\nNow let's call the **ONLY** method that's even available to you.\n\n```swift\nself.share(messageParameters)\n```\n\nAnd when you're done, you'll get one unified callback with the information of how the share attempt went.\n\n```swift\nself.sharingCompleted = { shareResult in\n    print(\"Was successful? \\(shareResult.success)\")\n    print(\"Sharing service: \\(shareResult.sharingService)\")\n}\n```\n\nYou can do the same for the other sharing destinations as well.\n\n```swift\nself.share(MailShareParameters)\nself.share(SocialShareParameters)\nself.share(ActivityShareParameters)\nself.share(PhotosShareParameters)\nself.share(PasteboardShareParameters)\n```\n\nStyling\n--- \n\nYou can also use Communicado to style the `MFMailComposeViewController` and `MFMessageComposeViewController` with just a few lines of code. This works around all of the hoops Apple makes you jump through to style the built in sharing controllers.\n\nAll you have to do is:\n\n```swift\nself.sharingTitleTextAttributes = [\n    NSAttributedString.Key.foregroundColor : UIColor.white,\n    NSAttributedString.Key.font : UIFont.systemFont(ofSize: 21.0)\n]\n\nself.sharingBarButtonItemAttributes = [\n    NSAttributedString.Key.foregroundColor : UIColor.purple,\n    NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16.0)\n]\n\nself.sharingBackgroundColor = UIColor.blue\n```\n\nAnd get something that looks like this: \n\n![](Images/styled_messages.png)\n\nBeautiful, isn't it?\n\n![](Images/yay.gif)\n\n## Requirements\n\n- iOS 9.0+\n- Xcode 8.0+\n\n## Installation\nFor **Swift 3** support, use version **2.0.2**. \u003cbr\u003e\nFor **Swift 4** support, you can use version **3.0**. \u003cbr\u003e\nFor **Swift 4.2** support, you can use version **3.1** or above. \u003cbr\u003e\nFor **Swift 5.1** support, you can use version **3.2.0** or above.\n\nYou can use [SPM](https://swift.org/package-manager/) to install `Communicado`.\n\nYou can also use [CocoaPods](http://cocoapods.org/) to install `Communicado` by adding it to your `Podfile`:\n\n```ruby\nplatform :ios, '9.0'\nuse_frameworks!\n\npod 'Communicado'\n```\n\nOr install it manually by downloading all the files in the `Source` folder and dropping them into your project.\n\n## About me\n\nHi, I'm [Joe](http://fabisevi.ch) everywhere on the web, but especially on [Twitter](https://twitter.com/mergesort).\n\n## License\n\nSee the [license](LICENSE) for more information about how you can use Communicado. I promise it's not GPL, because I am not \"that guy\".\n\n## The end?\n\nYes, this is the end. Hopefully Communicado makes your life easier. It probably won't help you pay your rent, but it might make it easier to share in your app.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmergesort%2Fcommunicado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmergesort%2Fcommunicado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmergesort%2Fcommunicado/lists"}