The only Connect API library you'd ever need

Overview

ConnectKit

A Swift client for Infinite Flight's Connect APIs, built using the Network framework.

Supported APIs

  • IF Session Discovery
  • Connect API V2
  • OpenTrack
  • ForeFlight

Supported targets

MacOS Mac Catalyst iOS tvOS
10.14 13 12 12

Package structure:

Module Prefix Description
ConnectV2 C2 Client for Connect V2 API
OpenTrack OT Client for sending OpenTrack broadcasts
ForeFlight FF Client for listening to ForeFlight broadcasts
ConnectKit -- Imports all of the modules above

Along with that, all packages include common components, prefixed with IF, such as IFListener used for discovering Infinite Flight sessions. If, for some reason, you want to specifically import only that functionality, you can import _ConnectKitCommon.

Getting started

Installation

if you're using XCode 11+, you can add ConnectKit as a dependency by clicking File -> Swift Packages -> Add Package Dependency and entering https://github.com/sqeezelemon/ConnectKit.git.

Alternatively, you can add it to your Package.swift file as follows:

dependencies: [
    // Add to your dependencies
    .package(url: "https://github.com/sqeezelemon/ConnectKit.git", from: "1.0.0")
]
...
.target(name: "YourTarget", dependencies: [
    // And then add to your target
    .product(name: "ConnectKit", package: "SwiftyLiveApi")
],

Discovering sessions

// 1. Create the listener
let listener = IFListener()

// 2. Add a sessionHandler
listener.sessionHandler = { (session) in 
    print($0.ipv4) // IFSession.ipv4
    listener.stop()
}

// 3. Start the listener
listener.start()

Using Connect V2 API

import ConnectV2 // or ConnectKit

// 1. Create the client
let client = C2Client()

// 2. Implement a delegate to receive data
class MyDelegate: C2ClientDelegate { ... }
let delegate = MyDelegate(...)
client.delegate = delegate

// 3. Connect to an Infinite Flight session
client.connect(to: ip)

// 4. Start using
if let id = client.findState(by: "aircraft/0/altitude_agl")?.id {
    client.get(50)
}

// 5. When finished, disconnect from IF.
client.disconnect()

Sending OpenTrack broadcasts

import OpenTrack // or ConnectKit

// 1. Create the client
let client = OTClient()

// 2. Connect to an Infinite Flight session
client.connect(to: ip)

// 3. Start using
client.send(x: x, y: y, z: z,
            roll: roll, pitch: pitch, yaw: yaw)

// 4. When finished, disconnect from IF.
client.disconnect()

Listening to ForeFlight broadcasts

import ForeFlight // or ConnectKit

// 1. Create the client
let listener = FFListener()

// 2. Implement a delegate to receive data
class MyDelegate: FFListenerDelegate { ... }
let delegate = MyDelegate(...)
listener.delegate = delegate

// 3. Start listening to broadcasts
listener.start()

// 4. When finished, stop the client.
listener.stop()

Bugs and enhancements

If you encounter a bug, please file an issue with the reproduction steps and any other information you consider helpful. If you want to suggest a change to the package, please make an issue with your proposal.

Contacts

@sqeezelemon on IFC

You might also like...
📱 A comprehensive test task for creating an autolayout interface, requesting an API and JSON parsing from Effective Mobile.
📱 A comprehensive test task for creating an autolayout interface, requesting an API and JSON parsing from Effective Mobile.

ECOMMERCE A comprehensive test task for creating an autolayout interface, requesting an API and JSON parsing from Effective Mobile. 👩‍🎨 Design ✨ Fea

Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend
Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend

Argo is a library that lets you extract models from JSON or similar structures in a way that's concise, type-safe, and easy to extend. Using Argo

[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021
[Deprecated] A shiny JSON parsing library in Swift :sparkles: Loved by many from 2015-2021

🚨 Deprecation Notice 🚨 Gloss has been deprecated in favor of Swift's Codable framework. The existing Gloss source is not going away, however updates

Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift.

Himotoki Himotoki (紐解き) is a type-safe JSON decoding library written purely in Swift. This library is highly inspired by the popular Swift JSON parsin

Library of Swiftui Views conforming to Codable, meaning we can produce JSON driven UI!

CodableView Library of Swiftui Views conforming to Codable, meaning we can produce JSON driven UI! Adding a CodableView Type Create View that conforms

Swift library for JSON-RPC

JSONRPC There are already a bunch of packages out there for doing JSON-RPC in Swift. This one is just very simple and makes no assumptions about the t

A type-safe JSON-RPC 2.0 library purely written in Swift

JSONRPCKit JSONRPCKit is a type-safe JSON-RPC 2.0 library purely written in Swift. // Generating request JSON let batchFactory = BatchFactory(version:

A JSON deserialization library for Swift

Mapper Mapper is a simple Swift library to convert JSON to strongly typed objects. One advantage to Mapper over some other libraries is you can have i

🧱 A JSON decoding/encoding library that handles optimistically or strictly.
🧱 A JSON decoding/encoding library that handles optimistically or strictly.

Do you need to handle the root cause of failure in decoding JSON? We often process the value as a default value if it could not be decoded from JSON.

Releases(1.0.0)
Owner
Alexander Nikitin
Computer Science @ ITMO
Alexander Nikitin
A simple educational application for the game Connect Four for two players

Connect4Game A simple educational application for the game Connect Four for two players. The algorithm checks the match of 4 tiles horizontally, verti

NIKOLAY NIKITIN 0 Oct 20, 2022
SwiftIB is a pure Swift implementation of the Interactive Brokers TWS API library on Mac OS X

SwiftIB is a pure Swift implementation of the Interactive Brokers TWS API library on Mac OS X, with Core Foundation of crouse. All the API interfaces are implemented. Request Market Data and Request History Data interface are thoroughly tested.

Harry Li 24 Sep 14, 2022
Developed with use Swift language. As a third party library used SDWebImage. JSON parsing using URLSession with TMDB API. This app provide by the Core Data structure.

Capstone Project ?? About Developed with use Swift language. As a third party library used SDWebImage. JSON parsing using URLSession with TMDB API. Ad

Ensar Batuhan Unverdi 9 Aug 22, 2022
App uses API to display information about City and State user using expandable table cell

Expandable Table Cell iOS App App uses API to display information about City and State user using expandable table cell Implemented Using MVVM with Cl

null 2 Nov 30, 2021
A project that uses the Flickr image search API and shows the results in a 3-column scrollable collection view

FlickrImagesDemo FlickrImagesDemo is a project that uses the Flickr image search API and shows the results in a 3-column scrollable collection view. 


प्रणय पवार 0 Dec 9, 2021
iTunesSearch: a screenshot listing project that using iTunes Search API

iTunesSearch iTunesSearch is a screenshot listing project that using iTunes Search API. This project written in Swift with MVVM architecture. Installa

null 0 Dec 14, 2021
Nikolai Saganenko 1 Jan 9, 2022
WPArticleView - SwiftUI View for Wordpress JSON API

WPArticleView Installation ... dependencies: [ .package(url: "https://github

Aleksei Ilin 2 Oct 20, 2022
A JSON parser with concise API written in Swift.

A JSON parser with concise API written in Swift Maps JSON attributes to different Swift types with just two methods: map and mapArrayOfObjects. The li

Evgenii Neumerzhitckii 14 Aug 13, 2018
CryptoWatch is an application to fetch the currency datas from an api and show their updated values to user. User is able to get the coin datas without an extra effort.

CryptoTracker In order to combine my work and studies, I made a small project that keeps the user's registration datas in memory, checks them when nee

Ömer Faruk Kılıçaslan 2 Jun 27, 2022