All Projects → insidegui → Multipeerkit

insidegui / Multipeerkit

Licence: bsd-2-clause
MultipeerConnectivity + Codable = ❤️

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Multipeerkit

Rome
Carthage cache for S3, Minio, Ceph, Google Storage, Artifactory and many others
Stars: ✭ 724 (-14.42%)
Mutual labels:  tvos
Zerotierone
A Smart Ethernet Switch for Earth
Stars: ✭ 7,839 (+826.6%)
Mutual labels:  peer-to-peer
Ratelimit
Simple utility for only executing code every so often.
Stars: ✭ 918 (+8.51%)
Mutual labels:  tvos
Rust Ipfs
The InterPlanetary File System (IPFS), implemented in Rust.
Stars: ✭ 739 (-12.65%)
Mutual labels:  peer-to-peer
Uproxy P2p
Internet without borders
Stars: ✭ 798 (-5.67%)
Mutual labels:  peer-to-peer
Orbit Db Http Api
A HTTP API Server for the OrbitDB distributed peer-to-peer database
Stars: ✭ 17 (-97.99%)
Mutual labels:  peer-to-peer
Maskbook
The portal to the new, open internet. ([I:b])
Stars: ✭ 691 (-18.32%)
Mutual labels:  peer-to-peer
Difference
Simple way to identify what is different between 2 instances of any type. Must have for TDD.
Stars: ✭ 837 (-1.06%)
Mutual labels:  tvos
Lf
Fully Decentralized Fully Replicated Key/Value Store
Stars: ✭ 809 (-4.37%)
Mutual labels:  peer-to-peer
Exhibit
Exhibit is a managed screensaver App for tvOS.
Stars: ✭ 19 (-97.75%)
Mutual labels:  tvos
Parade
Parallax Scroll-Jacking Effects Engine for iOS / tvOS
Stars: ✭ 754 (-10.87%)
Mutual labels:  tvos
Flexibleimage
A simple way to play with the image!
Stars: ✭ 798 (-5.67%)
Mutual labels:  tvos
Swiftyrsa
RSA public/private key encryption in Swift
Stars: ✭ 894 (+5.67%)
Mutual labels:  tvos
Manyverse
A social network off the grid (real repo at https://gitlab.com/staltz/manyverse)
Stars: ✭ 736 (-13%)
Mutual labels:  peer-to-peer
Apprepositorytemplate
The easiest way to start a new application project without any manual configuration
Stars: ✭ 24 (-97.16%)
Mutual labels:  tvos
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+3307.33%)
Mutual labels:  tvos
P2p
Practice project to demonstrate p2p file sharing.
Stars: ✭ 16 (-98.11%)
Mutual labels:  peer-to-peer
Peer Calls
Group peer to peer video calls for everyone written in Go and TypeScript
Stars: ✭ 837 (-1.06%)
Mutual labels:  peer-to-peer
Dat React Native
Browse through the web with the Dat protocol in your device!
Stars: ✭ 25 (-97.04%)
Mutual labels:  peer-to-peer
Peergos
A p2p, secure file storage, social network and application protocol
Stars: ✭ 895 (+5.79%)
Mutual labels:  peer-to-peer

MultipeerKit

A high-level abstraction built on top of the MultipeerConnectivity framework, which allows iOS, macOS and tvOS devices to exchange data between them over Wi-Fi networks, peer-to-peer Wi-Fi, and Bluetooth.

Sample app

Check the example folder for a sample implementation.

Sample

Info.plist configuration

In order for MultipeerKit to work when running on iOS 14, you will have to include two keys in your app's Info.plist file.

The keys are Privacy - Local Network Usage Description (NSLocalNetworkUsageDescription) and Bonjour services (NSBonjourServices).

For the privacy key, include a human-readable description of what benefit the user gets by allowing your app to access devices on the local network.

The Bonjour services key is an array of service types that your app will browse for. For MultipeerKit, the entry should be in the format _servicename._tcp, where servicename is the serviceType you've set in your MultipeerConfiguration. If you're using the default configuration, the value of this key should be _MKSVC._tcp.

If you do not configure the above keys properly, then MultipeerKit won't work.

Usage

The main class in this library is MultipeerTransceiver, which does both the sending and receiving aspects of the multipeer communication.

MultipeerKit can transmit and receive anything that conforms to the Codable protocol, which makes it easy for you to define your own message types.

// Create a transceiver (make sure you store it somewhere, like a property)
let transceiver = MultipeerTransceiver()

// Start it up!
transceiver.resume()

// Configure message receivers
transceiver.receive(SomeCodableThing.self) { payload, sender in
print("Got my thing from \(sender.name)! \(payload)")
}

// Broadcast message to peers
let payload = SomeEncodableThing()
transceiver.broadcast(payload)

For more information on how to use MultipeerKit, check out the documentation.

Integrating

MultipeerKit is a Swift package, to use it in your project, add this to your Package.swift file:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/insidegui/MultipeerKit.git", from: "0.2.0")
    ],
    ...
)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].