• Stars
    star
    1,089
  • Rank 42,533 (Top 0.9 %)
  • Language
    Swift
  • License
    BSD 2-Clause "Sim...
  • Created over 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MultipeerConnectivity + Codable = ❤️

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.4.0")
    ],
    ...
)

More Repositories

1

WWDC

The unofficial WWDC app for macOS
Swift
8,601
star
2

VirtualBuddy

Virtualize macOS 12 and later on Apple Silicon, VirtualBuddy is a virtual machine GUI for macOS M1, M2, M3
Swift
4,987
star
3

AssetCatalogTinkerer

An app that lets you open .car files and browse/extract their images.
Swift
2,050
star
4

PodcastMenu

Put Overcast on your Mac's menu bar
Swift
1,267
star
5

AnimojiStudio

Make cute emoji videos with unlimited duration and share anywhere (iPhone X, XS and XS Max only!)
Objective-C
1,180
star
6

AppleEvents

The unofficial Apple Events app for macOS
Objective-C
825
star
7

NoiseBuddy

Control the listening mode on your AirPods Pro in the Touch Bar or Menu Bar.
Swift
726
star
8

PlayAlways

Create Xcode playgrounds from your menu bar
Swift
550
star
9

DarkModeBuddy

Switch your Mac's system theme based on the ambient light intensity.
Swift
482
star
10

StatusBuddy

Keep track of Apple's developer and consumer system statuses right in your menu bar.
Swift
450
star
11

CloudKitCodable

An encoder and decoder for CKRecord
Swift
389
star
12

TouchBarSpaceFight

A simple, fun game for the MacBook Pro's Touch Bar
Swift
361
star
13

AppearanceMaker

Create custom appearances to customize your app's look with NSAppearance
Objective-C
234
star
14

F3X

Fight Flash Fraud: test your SD cards to see if they're genuine and in good working order
Objective-C
203
star
15

MacPreviewUtils

Handy tools for SwiftUI previews on macOS.
Swift
195
star
16

NoteTaker

A simple note taking app for macOS and iOS which uses Realm and CloudKit for syncing
Swift
174
star
17

GRProKit

Open-source ProKit clone
Objective-C
173
star
18

AudioCap

Sample code for recording system audio on macOS 14.4+
Swift
172
star
19

EmojiPickerUI

Framework implementing a macOS-style emoji picker for iPadOS.
Swift
168
star
20

MultipeerDemo

AirDrop-like functionality using MultipeerConnectivity
Swift
158
star
21

GRGlassWindow

A NSWindow subclass with a beautiful glass-like title bar
Objective-C
151
star
22

Milkshakr

A sample app used in many of my apps and workshops.
Swift
149
star
23

sheet

Custom iOS sheet
Swift
143
star
24

VisualPairingHack

An experiment with the private VisualPairing framework used for automatic iOS and watchOS device pairing
Objective-C
139
star
25

BlurredBgApp

iOS 13 app that shows the user's wallpaper as its background.
Swift
138
star
26

dmgdist

Automate the process of creating, uploading and notarizing the DMG of a Mac app.
Swift
135
star
27

MeshBuddy

Simple SwiftUI MeshGradient editor
Swift
130
star
28

CAARPlayer

An app that lets you view .caar files
Objective-C
119
star
29

FanFan

If you're a fan of fans, this app is for you.
Swift
117
star
30

CustomStatusBarWindow

Demonstrates a custom NSWindowController that can be attached to a NSStatusItem on macOS.
Swift
116
star
31

ocrit

Simple command-line utility for performing OCR using Apple's Vision framework
Swift
114
star
32

PIPContainer

An easy to use interface for picture-in-picture on macOS 10.12 and later
Objective-C
113
star
33

DealStack

Simple card stack implemented with SwiftUI
Swift
113
star
34

FOTWindow

A NSWindow subclass that makes auto hiding and showing the title bar (à la QuickTime X) a lot easier, and allows for a custom title bar drawing block.
Objective-C
112
star
35

CloudKitchenSink20

Sample code for my article on CloudKit.
Swift
110
star
36

ChromeCastCore

An open source implementation of the Google Cast SDK for macOS
Swift
107
star
37

GRCustomizableWindow

NSWindow subclass with support to custom titlebar height, background color and title color
Objective-C
103
star
38

DarkMode

Enable "real dark mode" on OS X / macOS
Objective-C
100
star
39

AppleRemoteFramework

Use the Apple Remote to control your OS X apps.
Objective-C
93
star
40

ThemingWithBundles

Sample project for my article on bundles
Swift
90
star
41

TextTransformer

Apple ExtensionFoundation/ExtensionKit sample app
Swift
81
star
42

GRNavigationController

Simple navigation controller for OS X apps.
Objective-C
77
star
43

mvcwithsugar

Companion Playground for my talk at dotSwift 2020
Swift
75
star
44

WWDC-tvOS

[ABANDONED] WWDC app for the new Apple TV
Swift
74
star
45

launchapp

Launch iOS applications from the command line (jailbreak only)
Shell
73
star
46

BreatheReplica

A simple replica of the Apple Watch Breathe app animation written in SwiftUI.
Swift
73
star
47

PearlSaver

Face ID detection animation as a screensaver
Objective-C
72
star
48

KeyframesPlayer

A simple macOS app to preview animations created with Facebook's keyframes framework
Swift
70
star
49

TwitterPublishPlugin

A plugin for Publish that let's you easily embed tweets in your posts.
Swift
70
star
50

GRPushSegue

A custom NSStoryboardSegue to make a nice iOS-like push transition.
Objective-C
68
star
51

FinderSyrahUI

An experiment showing how Finder might look like on the next OSX.
Objective-C
65
star
52

fluid-interactions-talk

A Swift playground implementing some simple fluid interactions.
Swift
64
star
53

D22Bar

Test your app with the new iPhone status bar
Objective-C
63
star
54

iosarchitecture

Randomly generate the next big thing ® on iOS app development
Swift
62
star
55

UXKitDemo

Demo app using Apple's private UXKit framework
Objective-C
61
star
56

GRProgressIndicator

reimplementation of NSProgressIndicator with some customization support
Objective-C
56
star
57

wwdc.io

The official website for the unofficial WWDC app for macOS 🤓 ❤️
HTML
55
star
58

Astronomer

Sample app for my talk at the CocoaHeads Conference
Swift
50
star
59

GRStatusBar

Safari-like status bar for macOS apps
Swift
50
star
60

DarkImagePublishPlugin

Publish plugin that lets you have both light and dark mode variants for images on your site 😎
Swift
50
star
61

GRVibrantTitlebarWindow

NSWindow with vibrant titlebar
Objective-C
49
star
62

Listr

Sample for my article on writing command line interfaces for iOS apps.
Swift
48
star
63

ConfigurableWidgetDemo

AppKit macOS app with a WidgetKit widget that can be configured with dynamic options from an intents extension
Swift
48
star
64

VLCX

[ABANDONED] QuickTime-like video player based on libvlc
Objective-C
45
star
65

CloudKitchenSink

A collection of CloudKit code samples
Swift
40
star
66

TTWindow

NSWindow subclass that allows you to set a custom tint color for the titlebar
Objective-C
37
star
67

followdown

Remove annoying badges from System Preferences on macOS.
Swift
37
star
68

VideoMeme

A sample project showing how a document-based app can be created with SwiftUI.
Swift
37
star
69

Flights

Simple flight information tracker for OS X.
Objective-C
36
star
70

DocumentBasedSwiftPlaygroundsApp

A document-based app in Swift Playgrounds 4 for iPad
Swift
31
star
71

Unsterificator

Mac menu bar app to quickly toggle mono/stereo audio
Swift
29
star
72

VisualEffectDebugger

Simple debugger for NSVisualEffectView
Objective-C
28
star
73

Chuck

The best Chuck Norris jokes in the palm of your hand
Swift
25
star
74

CheckmarkDemo

Sample code for my article on using Core Animation Archives
Swift
18
star
75

encodeformastodon

Simple command-line tool for macOS that encodes videos in a format suitable for publishing to Mastodon
Swift
17
star
76

Pawtraits_SampleCode

Sample code for the Fast & Fluid talk
Swift
17
star
77

GRCodeSignatureVerifier

Simple code signature verification for macOS apps
Objective-C
16
star
78

CAArchivesTalk

Code for my talk on CoreAnimation Archives
Swift
16
star
79

CoreFollowUpAttack

CoreFollowUp phishing attack on macOS
Objective-C
15
star
80

xGhostPreventer

An Xcode plug-in designed to prevent accidental app distribution through an unsafe version of Xcode
Objective-C
15
star
81

XPNotificationCenter

Cross-process notification center for iOS, WatchOS and OS X
Swift
15
star
82

WWDC-Win

WWDC app for Windows 10
C#
14
star
83

Binge

Projeto exemplo da minha palestra sobre desenvolvimento pra Mac
Swift
12
star
84

AdobeNativeFullscreen

A plugin to make some Adobe Creative Cloud apps support the native fullscreen mode on OS X.
Objective-C
11
star
85

killerapp

Handy helper to quickly restart stuff on OS X
Swift
10
star
86

libav-ios-build

Automatically builds libav as universal frameworks for iOS and iOS simulator.
Shell
7
star
87

IGListDiff

Diffing part of IGListKit isolated so it can be used on macOS
Objective-C
6
star
88

GRStatusBarDemo

Demo app for GRStatusBar
Swift
5
star
89

LocationAPI

Objective-C class for finding coordinates of a location using Google Maps
Objective-C
5
star
90

EnvVarExample

Sample of using xcconfig to inject environment variable values into app
Swift
5
star
91

GRThemeStore

A simple way of storing app assets (mainly images) in a compressed file
Objective-C
4
star
92

RealmBindingsDemo

A sample project demonstrating how to use Cocoa Bindings with Realm.
Swift
4
star
93

GRCodeSignatureVerifierDemo

Demo app for GRCodeSignatureVerifier
Swift
3
star
94

GRProKitResources

Contains the original sketch projects for the various UI elements in GRProKit
3
star
95

create_iconset

Shell script for creating OSX icon sets
Shell
2
star
96

pluggable

Sample cocoa app with support to javascript plugins, can be used as a starting point
Objective-C
2
star
97

wwdc-data

Static data used by the WWDC app for macOS
1
star
98

shakedown-data

Data used by Shakedown.app
1
star
99

correiocsv

Ruby
1
star