Back to OSS
Swift Package ユーティリティ

swift-ios-recorder

iOS のオンデバイス・ランタイムレコーダー。画面・状態・ネットワーク・AI デバッグ情報をキャプチャし Mac/MCP/AI へストリームする

Swift
iosdebuggingmcprecorder

swift-ios-recorder

開発中の iOS アプリの実行時を計測して保持するオンデバイス計器。撮った記録(スクショ + state + ログ)を Mac / MCP / AI へ流して、UI 確認ループの手作業を無くす。

Swift Platforms SPM

本質

計測(measure)+ 保持(retain)が核。 Mac 連携・MCP 連携はその上に載る能力の 1 つ。 詳細な設計は spec.md を参照。

構成

モジュール 役割
iOSRecorder コア。Record / Artifact / 各ポート / Session / RingBufferStore / Log・StateSource(依存ゼロ)
iOSRecorderScreenshot ScreenshotSource(UIKit drawHierarchy、iOS)
iOSRecorderUI SwiftUI 統合(フロートボタン・シェイク・アプリ内ビューア)
iOSRecorderBonjour Exporter / Receiver(同一 LAN 即時転送、Network framework)
iOSRecorderStore RecordStore のファイル実装(Mac、1 record = 1 フォルダ)
iOSRecorderMCP RecordStore を list_captures / get_capture / search_events / get_event に橋渡し(MCP stdio)
ios-recorder Mac companion exe(serve / mcp

使い方

iOS アプリ側(DEBUG 限定)

import iOSRecorder
import iOSRecorderUI
import iOSRecorderScreenshot
import iOSRecorderBonjour

let store = RingBufferStore()
let session = Session(
    sources: [
        ScreenshotSource(),
        StateSource(encoding: { await appState.snapshot() })
    ],
    store: store,
    exporters: [BonjourExporter()]   // 同一 LAN の Mac へ即時送信
)
let controller = RecorderController(session: session, store: store)

// ルートに 1 行。タップ/シェイクで計測、長押しで一覧。
ContentView().recorder(controller)

Mac 側

# Claude Code に MCP 登録するだけ。受信機は MCP プロセスに同居し、
# Claude Code の起動/終了に連動して起動/停止する(別デーモン不要)。
claude mcp add ios-recorder -- ios-recorder mcp

これで iPhone でフロートボタンを押す → Mac に届く → Claude Code が list_captures / get_capture(maxDimension で縮小) / search_events / get_event / delete_capture / clear_captures で画面+state を取得、という UI 確認ループが閉じる。

ios-recorder serve は受信機のみを単体起動する headless 運用向けの代替手段。

バイナリ更新時はコピー後に codesign --force --sign - <path> で再署名すること (ad-hoc 署名が無効化され起動時に SIGKILL されるため)。

開発

swift build && swift test          # 48 tests / 13 suites
# iOS 専用ターゲットのコンパイル確認:
xcodebuild build -scheme iOSRecorderUI -destination 'generic/platform=iOS'

同じカテゴリの OSS — ユーティリティ

swift-env

Swift Package

環境変数アクセスを宣言的に扱う Swift マクロ

Swift
· ユーティリティ
swift-macroenvironmentconfiguration

swift-physical-units

Swift Package

コンパイル時に次元検査を行う型安全な物理単位ライブラリ

Swift
· ユーティリティ
unitstype-safephysics

© 2026 Kyoichi Taniguchi. All rights reserved.