Open Source Swift Library That Simplifies Working With The iOS Multipeer Connectivity API

Previously I mentioned a nice source code example on using iOS’s Multipeer Connectivity API along with a getting started tutorial.

Here’s an open source Swift library that simplifies usage of the MultipeerConnectivity framework called PeerKit from JP Simard.

Peerkit greatly simplifies finding and connecting to peers, and sending/receiving data and more.

Here’s some example code from the readme showing how to connect to peers, and send some simple data:

// Automatically detect and attach to other peers with this service type
PeerKit.transceive("com.jpsim.myApp")

enum Event: String {
    case StartGame = "StartGame", EndGame = "EndGame"
}

// Send a StartGame event with attached data to all peers
PeerKit.sendEvent(Event.StartGame.rawValue, object: ["myInfo": "hello!"])

You can find PeerKit on Github here.

You can also find a simple example card game that uses PeerKit on Github here.

A nice framework simplifying the Multipeer Connectivity API.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source Swift Library That Simplifies Working With The iOS Multipeer Connectivity API

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *