{"id":16756724,"url":"https://github.com/dingwilson/multipeer","last_synced_at":"2025-10-09T18:39:47.594Z","repository":{"id":62448160,"uuid":"119933196","full_name":"dingwilson/MultiPeer","owner":"dingwilson","description":"📱📲 A wrapper for the MultipeerConnectivity framework for automatic offline data transmission between devices","archived":false,"fork":false,"pushed_at":"2021-05-28T04:17:17.000Z","size":3253,"stargazers_count":240,"open_issues_count":10,"forks_count":31,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-11T20:42:50.308Z","etag":null,"topics":["bluetooth","carthage","cocoapods","connection","ios","mesh-networks","multipeer","multipeerconnectivity","multipeerconnectivity-framework","offline","swift","swift-package-manager","wifi"],"latest_commit_sha":null,"homepage":"http://wilsonding.com/MultiPeer","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/dingwilson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-02T04:47:19.000Z","updated_at":"2025-06-16T22:13:05.000Z","dependencies_parsed_at":"2022-11-01T23:05:57.890Z","dependency_job_id":null,"html_url":"https://github.com/dingwilson/MultiPeer","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dingwilson/MultiPeer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dingwilson%2FMultiPeer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dingwilson%2FMultiPeer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dingwilson%2FMultiPeer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dingwilson%2FMultiPeer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dingwilson","download_url":"https://codeload.github.com/dingwilson/MultiPeer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dingwilson%2FMultiPeer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266851618,"owners_count":23995317,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bluetooth","carthage","cocoapods","connection","ios","mesh-networks","multipeer","multipeerconnectivity","multipeerconnectivity-framework","offline","swift","swift-package-manager","wifi"],"created_at":"2024-10-13T03:26:48.675Z","updated_at":"2025-10-09T18:39:42.556Z","avatar_url":"https://github.com/dingwilson.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/dingwilson/MultiPeer/raw/master/Assets/banner.png\" title=\"MultiPeer\"\u003e\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/dingwilson/MultiPeer.svg?branch=master)](https://travis-ci.org/dingwilson/MultiPeer)\n[![CocoaPods Version Status](https://img.shields.io/cocoapods/v/MultiPeer.svg)](https://cocoapods.org/pods/MultiPeer)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-Compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![doccov](https://wilsonding.com/MultiPeer/badge.svg)](https://wilsonding.com/MultiPeer)\n![iOS](https://img.shields.io/badge/os-iOS-green.svg?style=flat)\n![MacOS](https://img.shields.io/badge/os-MacOS-green.svg?style=flat)\n![tvOS](https://img.shields.io/badge/os-tvOS-green.svg?style=flat)\n[![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)](https://swift.org)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n\nA wrapper for Apple's MultipeerConnectivity framework for offline data transmission between Apple devices. This framework makes it easy to automatically connect to multiple nearby devices and share information using either bluetooth or wifi radios.\n\n1. [Features](#features)\n2. [Integration](#integration)\n    - [CocoaPods](#cocoapods)\n    - [Carthage](#carthage)\n    - [Swift Package Manager](#swift-package-manager)\n3. [Usage](#usage)\n4. [Example](#example)\n5. [License](#license)\n6. [Authors](#authors)\n\n## Features\n\n- [x] Supports iOS/macOS/tvOS\n- [x] Auto Connection\n- [x] Auto Invitations/Advertising\n- [x] Send/Receive data via MultipeerConnectivity Framework\n- [x] Specify data types for easy handling\n\n## Integration\n\n#### CocoaPods\nYou can use [CocoaPods](http://cocoapods.org/) to install `MultiPeer` by adding it to your `Podfile`:\n\n```ruby\npod 'MultiPeer'\n```\n\n#### Carthage\nYou can use [Carthage](https://github.com/Carthage/Carthage) to install `MultiPeer` by adding it to your `Cartfile`:\n\n```\ngithub \"dingwilson/MultiPeer\"\n```\n\n#### Swift Package Manager\nFor [SPM](https://swift.org/package-manager/), add the following to your package dependencies:\n\n```\n.package(url: \"https://github.com/dingwilson/MultiPeer.git\", .upToNextMinor(from: \"0.0.0\"))\n```\n\n## Usage\n\nTo get started, import MultiPeer.\n\n```swift\nimport MultiPeer\n```\n\nThen, simply initialize MultiPeer with the name of your session (`serviceType`). There are two modes of connections (`advertiser` and `browser`). To utilize both, simply use `.autoConnect()`.\n\n```swift\nMultiPeer.instance.initialize(serviceType: \"demo-app\")\nMultiPeer.instance.autoConnect()\n```\n\nAny data transmitted by MultiPeer will always be accompanied by a numerical \"type\", to ensure other peers know what kind of data is being received, and how to properly process it. You can manage this by creating a `UInt32` enum, as shown below:\n\n```swift\nenum DataType: UInt32 {\n  case string = 1\n  case image = 2\n  // ...\n}\n```\n\nTo send data, simply use the `.send(object: type:)` function:\n\n```swift\nMultiPeer.instance.send(object: \"Hello World!\", type: DataType.string.rawValue)\n```\n\nTo receive data, we must conform to the `MultiPeerDelegate` protocol:\n\n```swift\nfunc multiPeer(didReceiveData data: Data, ofType type: UInt32, from peerID: MCPeerID) {\n  switch type {\n    case DataType.string.rawValue:\n      let string = data.convert() as! String\n      // do something with the received string\n      break\n      \t\t\n    case DataType.image.rawValue:\n      let image = UIImage(data: data)\n      // do something with the received UIImage\n      break\n      \t\t\n    default:\n      break\n  }\n}\n\nfunc multiPeer(connectedDevicesChanged devices: [String]) {\n}\n```\n\nEnsure that you set the MultiPeer delegate.\n\n```swift\nMultiPeer.instance.delegate = self\n```\n\nFinally you'll need to enable incoming / outgoing connections in your entitlements.\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://github.com/dingwilson/MultiPeer/raw/master/Assets/entitlements.png\" title=\"Enabling entitlements\"\u003e\n\u003c/p\u003e\n\nCongratulations! You have successfully sent data using MultiPeer! For more detailed information (including details of other functions), please see the [docs](http://wilsonding.com/MultiPeer).\n\n## Example\nFor an example app using MultiPeer, checkout [MultiPeer_Sample](https://github.com/dingwilson/MultiPeer_Sample).\n\n## License\n`MultiPeer` is released under an [MIT License](http://opensource.org/licenses/MIT). See [LICENSE](LICENSE) for details.\n\n## Authors\n\n- [Wilson Ding](https://github.com/dingwilson)\n\nProject heavily inspired by [Apple-Signal](https://github.com/kirankunigiri/Apple-Signal).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdingwilson%2Fmultipeer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdingwilson%2Fmultipeer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdingwilson%2Fmultipeer/lists"}