Xcode-streamdeck-plugin - A Stream Deck plugin for Xcode

Overview

Stream Deck Xcode Plugin

This repository contains a Stream Deck plugin to add some useful Xcode actions to your Stream Deck.

It also contains a handy template for building your own Stream Deck plugins, and the project is designed to be a great starting off point for a new plugin. You'll find more details on that below.

Screenshot

Installation & Use

To use the plugin, download the latest release from the Releases page and double-click it to install it into the Stream Deck application. Once installed, you'll see a new Xcode category containing some new actions:

  • Toggle Breakpoints toggles breakpoints on and off.

  • Pause Debugger pauses or resumes the current debugger session.

  • View Debugger triggers the view debugger.

The actions target the frontmost Xcode window for getting state and triggering actions.

How Does It Work?

The plugin uses the Accessibility APIs to interact with Xcode. If it doesn't seem to work, make sure the Stream Deck application has Accessibility access in the Security & Privacy pane of System Preferences and restart it.

If you're interested in the details, the meat of the logic is implemented in the XcodeObserver.swift file.

What Problem Does This Solve?

This plugin attempts to bring back the best feature of the MacBook Pro Touch Bar (in my opinion) — global debugger actions. Being able to manipulate Xcode while the app you're debugging is frontmost is really useful in some situations:

  • Let's say you have an exception breakpoint set, and you want to target some specific exceptions. If code in your app uses exceptions for flow control (which can be quite common in Swift), this can be a bit of a nightmare to get through. Being able to enable/disable breakpoints while your app is frontmost makes this much easier — just keep breakpoints disabled until you're at the correct point in your app's lifecycle, tap the button on your Stream Deck, and off you go!

  • Often the most tricky UI bugs to figure out are transient ones — bugs that happen during transitions or other animations. Triggering the view debugger at the right instant is critical for this, and being able to trigger it while your app is frontmost makes it a lot easier to get exactly the right moment captured.

Stream Deck Plugin Template

Alongside the Xcode plugin, this project contains a plugin template that makes it super easy to make your own Stream Deck plugins in Swift. It's heavily inspired by the excellent streamdeck-template-swift project by Jarno Le Conté, but differs in a couple of meaningful ways:

  • It's 100% Swift.

  • It uses the system-provided WebSocket APIs available from macOS 10.15, which means there are no external dependencies.

  • It performs a lot more packaging and distribution work as part of the build process, making the build process completely self-contained in Xcode.

How To Use

The plugin template implements the underlying Stream Deck protocols for you, handing plugin registration, message handling, and so on. The project also contains a number of build phases that construct the correct plugin structure on disk and packages it using Elgato's own DistributionTool, which is included in this repo.

Everything in the Common Sources folder should be used without modification. To build your own plugin:

  • Edit Build Settings.xcconfig with your plugin's details. The values in this file are used in several places in the build process: filling out the manifest.json file required by the Stream Deck plugin architecture, naming files on disk, and embedding values into the plugin binary. This config file makes sure everything stays in sync.

  • Edit manifest.json to add your plugin's actions. Don't edit the values that look like $(PLUGIN_CATEGORY) — they'll be filled in automatically at build time. Details on the actions structure can be found here.

  • Make a new class that implements the ESDConnectionManagerDelegate protocol. This is where your plugin's core logic lives. You'll find an empty implementation in the BasicPluginImplementation.swift file.

  • Modify the createEventHandler() function in PluginImplementation.swift to return a new instance of your class when called.

  • Build the Stream Deck Plugin target. All being well, you'll have a packaged plugin! Choose Product → Show Build Folder in Finder to get at it.

Implementing a Plugin

The methods implemented in your plugin class from ESDConnectionManagerDelegate are your interaction point with the Stream Deck. Take a look in ESDConnectionManagerDelegate.swift for documentation. A few pointers:

  • connectionManagerDidEstablishConnectionToPluginHost(_:) will be called very early in the plugin's lifecycle, giving you a connection manager you can use to perform actions on the Stream Deck. See the documentation in ESDConnectionManager.swift for what you can do.

  • When you receive events and otherwise interact with the Stream Deck Plugin API, you'll see references to an actionIdentifier, a deviceIdentifier, and a context:

    • The actionIdentifier refers to the kind of action for a given item. The Xcode plugin has three actions — toggle breakpoints, pause debugger, and view debugger. In the Xcode plugin, only the actionIdentifier is checked when a key is pressed — we don't care which exact key on the device the command came from, just what the user wants to do.

    • The deviceIdentifier refers to a physical piece of hardware. If you care, the method connectionManager(_, deviceDidConnect:, deviceInfo:) will be called as hardware devices become available. You can get details of the hardware here.

    • The context refers to a specific instance of an action. Since an action can be placed into multiple screens on a Stream Deck (or even multiple times on one screen), the context disambiguates between them. In the Xcode plugin, we use the context when an action fails — we want to put a warning icon on the exact button the user actually pressed.

  • In general, the template is a no-frills implementation of the Stream Deck SDK. Reading through and understanding the Elgato Documentation will get you a long way — particularly the Manifest, Events Received, Events Sent, Create your own plugin, and Style Guide sections.

Comments
  • Is it supporting Xcode 13.3?

    Is it supporting Xcode 13.3?

    Thanks for making this, and this is such a great replacement of TouchBar

    However, it seems become malfunction after upgrading to Xcode 13.3. Is there a setting or something to control this?

    opened by harryworld 2
  • Nicer button icons

    Nicer button icons

    The button icons are fine, but not great (particularly the "unknown" variants — Sketch really doesn't have a way to force dashes in lines to pixel align). It'd be nice if we had better ones.

    enhancement 
    opened by iKenndac 0
  • Some Xcode events aren't picked up by plugin

    Some Xcode events aren't picked up by plugin

    Some Xcode events don't issue accessibility notifications that I can see, which means the plugin can become out of sync with reality. We may need to implement a fallback poll.

    Right now, known problems:

    • Clicking the breakpoint icon in the debug bar to toggle breakpoints doesn't get picked up.
    • Clicking the pause button in the debug bar to pause the current session doesn't get picked up if Xcode is already active.
    bug 
    opened by iKenndac 0
  • Accessibility notifications aren't firing

    Accessibility notifications aren't firing

    The XcodeObserver class should be receiving notifications from the accessibility system, but it isn't when it's running in the plugin (it works in a regular AppKit app). Perhaps it's because the plugin doesn't have a bundle identifier etc.

    bug 
    opened by iKenndac 0
  • Implement property inspector interop APIs

    Implement property inspector interop APIs

    We're currently missing the APIs to interop with the property inspector. The Xcode plugin doesn't use the property inspector, but it'd be nice to have for the template.

    Missing:

    • sendToPropertyInspector command
    • sendToPlugin event (it's a received event despite the name)
    enhancement 
    opened by iKenndac 0
Releases(1.0.1)
Owner
Daniel Kennett
Cocoa developer, mountain biker, model railway owner. I spend my days working on @Cascable.
Daniel Kennett
Xcode plugin that brings ⇧⌘T from AppCode over to Xcode

Aviator An Xcode Plugin that brings ⇧⌘T over to Xcode This minimal plugin allows you to use the key combo ⇧⌘T to toggle between source and test files.

Mark Sands 29 Aug 18, 2018
Cordova-plugin-saveimage - This plugin helps you save images

cordova-plugin-saveimage This plugin helps you save images on iOS/Android Instal

Bernat 2 May 11, 2022
Xcode plugin that moves the instruction pointer to the selected line

SFJumpToLine Xcode plugin that moves the instruction pointer to the selected line. Install: Install via Alcatraz Or clone and build the project, then

Simone Ferrini 9 Jan 14, 2021
An Xcode plugin for manually symbolicating crash logs

CrashSymbal An Xcode plugin for manually symbolicating crash logs Install Build the project to install the plugin. The plugin gets installed in /Libra

Julian F. Weinert 38 Jun 3, 2021
XcodeColorSense - An Xcode plugin that makes working with color easier.

XcodeColorSense An Xcode plugin that makes working with color easier. Inspired by ColorSense-for-Xcode with extra care for Hex color Features Show col

Khoa 77 Jul 1, 2022
A Xcode plugin to add highlight to the instances of selected symbol.

Auto Highlight Symbol About Xcode 8 Xcode 8 does't support plugins anymore, but there is a workaround, use at your own risk. Xcode can highlight insta

Nelson 83 Jan 3, 2023
An Xcode 7 plugin to build and run an app across multiple iOS devices with one click.

RunEverywhere Xcode Plugin Overview An Xcode 7 plugin to build and run an app across multiple iOS devices with one click. Gone are the days of manuall

Eric Mika 322 Sep 7, 2022
Xcode plugin to open the GitHub page of the commit of the currently selected line in the editor window.

Show in GitHub / BitBucket Xcode plugin to open a related Github or BitBucket page directly from the Xcode editor code window. Installs easily through

Lars Schneider 242 Jul 20, 2022
An Xcode plugin to improve dealing with colors in your project

Crayons is an Xcode7 plugin with various features that improve working with colors in your projects ##Code palettes (iOS only) You can share palettes

Fabio Ritrovato 477 Sep 23, 2022
Xcode plugin for filtering the console area.

MCLog This plugin lets you easily filter the Xcode console log output. While you can already search the text in the console log output you are still l

Michael Chen 591 Oct 31, 2022
A VisionCamera Frame Processor plugin for fast buffer resizing

vision-camera-resize-plugin A VisionCamera Frame Processor Plugin for fast buffer resizing. By resizing buffers to a smaller resolution, you can achie

Marc Rousavy 16 Aug 10, 2022
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
Cordova plugin for detect screenshots and recordings

cordova-plugin-detect-screen-capture This plugin detects screen recording and screenshot events. The plugin will only work on devices with iOS >= 7 Su

Sasha 0 Nov 4, 2021
API surface for Swift plug-ins using the Swift Plugin Manager

SwiftPlugin The minimal API surface required for the Swift Plugin Manager to create instances from a loaded plugin. Additional documentation and refer

Joakim Hassila 2 Mar 25, 2022
Cordova plugin to display a native color-picker dialog

Color Picker Plugin for Cordova (cordova-plugin-color-picker) Description This plugin allows you to display a color-picker native dialog in iOS and An

Antonio Vargas 1 May 10, 2022
Metazoom - A virtual camera plugin to pixellatedly share your screen

MetaZoom A virtual camera plugin to pixellatedly share your screen. See LICENSE.

Sahil Lavingia 22 Jan 4, 2023
Flutter openvpn - A new Flutter plugin that uses OpenVpn

flutter_openvpn A new Flutter plugin that uses OpenVpn. Installation Depend on i

Ferdi Gökdemir 0 Jan 8, 2022
PerFolderResourcesPublishPlugin - Per-folder resources plugin for the Publish package

Per-folder resources for Publish A Publish plugin that copies per-folder resourc

Tom Harrington 1 Feb 18, 2022
Touch ID Plugin (Cordova) for iOS

cordova-plugin-gctouch-id Touch ID Plugin (Cordova) for iOS Author: Giulio Caruso aka rdn Index Description Technical Documentation Screenshots Adding

Giulio Caruso 20 Jan 3, 2022