Contents

lightbeamapps/triggerkit

TriggerKit is a Swift framework for binding events to your app's code. You can use TriggerKit with iOS and iPad applications. MacOS is enabled in the Package, but not currently tested.

Event Types supported

  • MIDI CC βœ…
  • MIDI Notes βœ…

Event Types planned πŸ—ΊοΈ

  • OSC
  • Gamepad

These event types are planned as additions to TriggerKit, in future releases. Please don't hesitate to open an issue or create a PR for features you need πŸ™

Quick start 🏁

  • Add TriggerKit to your project via Swift Package Manager: https://github.com/lightbeamapps/TriggerKit
  • Create an enumeration of the actions your app wants to map, that conforms to TKAppActionConstraints
  • Instantiate the TriggerKit Bus
let config = TKBusConfig(clientName: "TriggerKit", model: "TriggerKit", manufacturer: "Lightbeam Apps")
let bus = TKBus<YourAppAction>(config: config)
  • Add Mappings
let mapping = TKMapping(appAction: TestAcYourAppActiontion.action1, event: TKEvent.midiCC(trigger: .init(cc: 1)))

bus.addMapping(mapping) { payload in
    // Do something!
}

You now have a TriggerKit Bus, and your first mapping πŸŽ‰!

Usage and key concepts

Codable

Once you have created actions and mappings, you can encode these to persist them to disk and retrieve at run time.

Learning events

You can set a single callback for all events with the bus function:

bus.setEventCallback() { event in 
    // Use/persist the most recent event to update or add a mapping
}

The demo application shows an example of this.

Examples

  • TriggerKitDemo - a SwiftUI app that shows example mappings, and an event learn set up.

Inbuilt views for Bluetooth midi

TriggerKit has some wrappers for the CoreAudio BlueTooth MIDI detection views:

  • TKBluetoothMIDIView SwiftUI
  • TKBTMIDICentralViewController UIKit

Contributing

Code of Conduct and Contributing rules πŸ§‘β€βš–οΈ

  • Our guide to contributing is available here: CONTRIBUTING.md.
  • All contributions, pull requests, and issues are expected to adhere to our community code of conduct: CODE_OF_CONDUCT.md.

Key contributors ⚑️

Admin

License πŸ“ƒ

TriggerKit is licensed with the BSD-3-Clause license, more information here: LICENSE.MD

This is a permissive license which allows for any type of use, provided the copyright notice is included.

Acknowledgements πŸ™

  • MIDIKit, without which this library couldn't support MIDI Events: https://github.com/orchetect/MIDIKit

Package Metadata

Repository: lightbeamapps/triggerkit

Default branch: main

README: README.md