/tapkit-ios-sdk:tapkit-dpadfrom tapkit-ios-sdk
Builds a D-Pad controller for TapXR/TapBand using swipe, pinch, hold, and fist gestures. Handles direction, selection, rotate/drag modes, and hide/show states.
Ships in tapkit-ios-sdk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
TapXR (current developer firmware) and TapBand. It needs tapXRAirGestured and IMU motion. Same interaction as the D-Pad page in the TAP_EV sandbox (https://tapwithus.github.io/TAP_EV/). TapBand is coming soon, same BLE API: https://www.tapwithus.com/tapband-waitlist/
The iOS SDK already collapses the raw gesture stream into edges. Drop is the release and FistEnd is the show, so this controller does not count a run of "none" packets. It still ignores a second copy of the same edge within 40 ms. See tapkit-air-gestures for raw class indexes vs the processed layer.
| User does | TAPXRAirGesture | Event |
|---|---|---|
| Swipe left / right / up / down | SwipeLeft 17, SwipeRight 18, SwipeUp 19, SwipeDown 20 | .direction("left") and so on |
| Short pinch thumb + index / middle / ring / pinky | ClickIndex…ClickPinky (1–4) | .pinch(0...3), only when nothing is held |
| Hold a pinch | DragIndex…DragPinky (5–8) | .hold(i), mode "pending" |
| …and twist 25° or more within 1 s | roll from tapDidChangeOrientation | .mode("rotate"), then .rotate(degrees) |
| …and do not twist | — | after 1 s .mode("drag"), then .drag |
| Relax the hand | Drop (9) | .release(i) |
| Make a fist / relax the fist | FistBegin 14 / FistEnd 15 | .hide / .show |
A repeat of the same swipe, click, drag, or fist-begin within 40 ms is ignored.
stateDiagram-v2
idle --> pending: DragIndex..DragPinky
pending --> rotate: roll travel >= 25 deg
pending --> drag: 1 s without enough roll
rotate --> idle: Drop
drag --> idle: Drop
idle --> hidden: FistBegin
hidden --> idle: FistEnd
Copy scripts/DpadController.swift. It has no Bluetooth in it. TAPKit-Example compiles that same file into the Knob / D-Pad screen (GestureSampleViewController). The example target is Swift 4, and the script stays on that syntax.
onGesture(rawValue, now:) takes gesture.rawValue and ProcessInfo.processInfo.systemUptime (or any monotonic seconds).onMotion(dx:dy:roll:now:) takes moused deltas and orientation roll.tick(now:) locks drag if motion packets stop before the window ends.held, mode ("pending", "rotate", "drag", or nil), and hidden are the state to draw.Required device setup, after start() and tapConnected. Same as the knob: controller mode, model detection, IMU motion, air-gesture model, stream op mode. On TapXR and TapBand, setTAPXRState(.airMouse()) covers the vision model.
private var latestDelta = (dx: 0, dy: 0)
func tapXRAirGestured(identifier: String, gesture: TAPXRAirGesture) {
apply(dpad.onGesture(gesture.rawValue, now: ProcessInfo.processInfo.systemUptime), identifier)
}
func moused(identifier: String, velocityX: Int16, velocityY: Int16, isMouse: Bool) {
guard isMouse else { return }
latestDelta = (Int(velocityX), Int(velocityY))
}
func tapDidChangeOrientation(roll: Int, pitch: Int, yaw: Int) {
let sample = latestDelta
latestDelta = (0, 0)
apply(
dpad.onMotion(dx: sample.dx, dy: sample.dy, roll: Double(roll), now: ProcessInfo.processInfo.systemUptime),
nil
)
}
func apply(_ events: [DpadEvent], _ identifier: String?) {
for event in events {
switch event {
case .direction(let name):
move(name)
case .pinch(let index):
select(index)
buzz(identifier)
case .hold(_), .mode(_):
buzz(identifier)
case .rotate(let degrees):
rotate(degrees)
case .drag(let dx, let dy):
drag(dx, dy)
case .release(_):
snapBack()
case .hide:
hideControls()
case .show:
showControls()
}
}
}
func buzz(_ identifier: String?) {
guard let identifier else { return }
TAPKit.sharedKit.vibrate(durations: [40], forIdentifiers: [identifier])
}
move, select, rotate, drag, snapBack, hideControls, and showControls are the app's own functions. Orientation has no device identifier; keep a single active Tap.
| Argument | Default | Effect |
|---|---|---|
rotateLockDegrees | 25 | Roll travel that chooses rotate. Raise it if drag is chosen too rarely. |
lockWindow | 1.0 | Seconds to decide between rotate and drag. |
debounce | 0.040 | Ignore a repeat of the same edge inside this window. |
.release.PotentialDragOrClick* (raw 10–13) is ignored. Wait for the click, drag, or drop.
ClickIndex confirms, ClickMiddle goes back, fist closes.See also tapkit-knob and tapkit-air-gestures.
What SKILL.md sets; muted values are Claude Code's defaults
8 skills in this plugin
/tapkit-air-gesturesHandle TAPXRAirGesture (processed click, drag, drop, fist, swipe) on TapXR and TapBand, document raw firmware class indexes, switch tapping vs air-gesture models, and handle Tap Strap TAPAirGesture. Use for air gestures, pinch, swipe, fist, TAPXRState, or raw detections./tapkit-build-an-appBuild a complete iOS app or interactive experience controlled by a TAP device. Use when the user asks to build, make, or create something with their Tap, including games, presentations, media control, or creative tools./tapkit-getting-startedFirst skill for any TAP iOS app. The order is add TAPKit and NSBluetoothAlwaysUsageDescription, pair the Tap in Settings, addDelegate, setDefaultTAPInputMode (and setDefaultTAPXRState for TapXR), then start(). start() alone delivers no taps. Use for adding the SDK, pairing, connecting, setup, or no tap events.npx claudepluginhub tapwithus/tap-ios-sdk --plugin tapkit-ios-sdkOther plugins' skills for the same job