Latest 1.0.2
Homepage https://github.com/kboy-silvergym/BeerKit
License MIT
Platforms ios 10.0

BeerKit 🍺

platform swift license
tw

About

The framework which is for MultipeerConnectivity inspired by PeerKit. 🍻

PeerKit has some bags and it hasn’t maintained recently, so I made this repository.

Requirements

Swift 4.2. Ready for use on iOS 10.0+

Installation

via Cocoapods

pod 'BeerKit'

Usage

See Example.

Initialize

BeerKit.transceive(serviceType: "BeerDemo")

Send data

let message = MessageEntity(name: UIDevice.current.name, message: "Hi")
let data: Data = try! JSONEncoder().encode(message)
BeerKit.sendEvent("message", data: data)

Observe Connected

BeerKit.onEvent("message") { (peerId, data) in
    DispatchQueue.main.async {
        self.deviceNameLabel.text = peerId.displayName
    }
}

Observe Event

BeerKit.onEvent { (peerId, event, data) in
    guard let data = data,
        let message = try? JSONDecoder().decode(MessageEntity.self, from: data) else {
            return
    }
    self.messages.append(message)

    DispatchQueue.main.async {
        self.tableView.reloadData()
    }
}

Author 🍻

BeerKit

KBOY (Kei Fujikawa)

iOS Developer in Tokyo Japan, working on AR startup named Graffity Inc.

License

BeerKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "BeerKit",
    "version": "1.0.2",
    "summary": "The framework which is for MultipeerConnectivity.",
    "description": "- The framework which is for MultipeerConnectivity inspired by PeerKit.",
    "homepage": "https://github.com/kboy-silvergym/BeerKit",
    "license": "MIT",
    "authors": "Kei Fujikawa",
    "social_media_url": "http://twitter.com/kboy_silvergym",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/kboy-silvergym/BeerKit.git",
        "tag": "1.0.2"
    },
    "source_files": "BeerKit/**/*.swift",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This