Swiftpack.co - polarcop/swift-LeapEdge as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by polarcop.
polarcop/swift-LeapEdge 1.1.0
🐇 Swift client library for the Leap Edge socket service
⭐️ 2
🕓 1 year ago
iOS macOS
.package(url: "https://github.com/polarcop/swift-LeapEdge.git", from: "1.1.0")

LeapEdge

This package was ported from leap-edge-js to support Swift.

An unofficial utility library for connecting and receiving events from Leap Edge. Used for Channels.

Installation

With Package Manager

.package(url: "https://github.com/polarcop/swift-LeapEdge.git", from: .init(1, 0, 0))

Usage

Basic

import LeapEdge

let leap = LeapEdge(auth: .init(token: "leap_token_xxx", projectId: "project_xxx"))
leap.connect()

leap.on { (message: LeapEdge.ConnectionState) in
  // Do something with the current connection state.
}

leap.on { (message: LeapEdge.ServiceEvent) in
  // Wait for an event and respond accordingly
}

If you don't want to supply a token (e.g. to only connect to unprotected channels), then pass nil for token in the authentication parameters object

GitHub

link
Stars: 2
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

Update client options
1 year ago

Instead of the partial dictionary for setting options, this can be passed as a struct directly.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics