Skip to Content
v1.29.0 · shipped Own analytics id., Refused batches are not replayed forever. Read the changelog →
QuickstartiOS (Swift)

iOS quickstart

The MushiMushi Swift package ships shake-to-report, a file-backed offline queue, automatic device context, a breadcrumb ring buffer and PII scrubbing.

Preview. The Swift SDK is not published to CocoaPods and has no release tag yet, so a version rule like from: "0.4.0" cannot resolve. Install it from the repository’s master branch as shown below. npx mushi-mushi does not set up native iOS projects.

Install (Swift Package Manager)

In Xcode → File → Add Package Dependencies, enter the URL below and set the dependency rule to Branch → master, then add the MushiMushi library to your app target.

https://github.com/kensaurus/mushi-mushi

Or in a Package.swift:

Package.swift
dependencies: [ .package(url: "https://github.com/kensaurus/mushi-mushi.git", branch: "master"), ], targets: [ .target(name: "MyApp", dependencies: [ .product(name: "MushiMushi", package: "mushi-mushi"), ]), ]

SwiftPM clones the whole monorepo the first time, so the initial resolve is slower than a single-package repo. CocoaPods is not supported yet.

Initialize

endpoint is required: use the hosted API below, or your own if you self-host.

MyApp.swift
import SwiftUI import MushiMushi @main struct MyApp: App { init() { Mushi.shared.configure(with: MushiConfig( projectId: "YOUR_PROJECT_ID", apiKey: "mushi_...", endpoint: "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api", triggerMode: .both // .shake | .button | .both | .none )) } var body: some Scene { WindowGroup { ContentView() } } }

Open the widget or submit a report

// Present the bottom-sheet widget Button("Report a bug") { Mushi.shared.showWidget() } // File a report from code, no UI Mushi.shared.report( description: "Pull-to-refresh spinner never stops on Wi-Fi switch.", category: "bug" ) // Forward a caught error do { try riskyOperation() } catch { Mushi.shared.captureError(error) }

Sentry

The Swift package has no Sentry bridge. Keep initialising Sentry in your app and attach context to Mushi reports with Mushi.shared.setMetadata(_:value:).

Full API: MushiMushi (iOS).

Last updated on