Skip to Content
v1.33.8 · shipped One-screen report · Looks like your app 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.

Get your project ID and API key

The SDK needs two values from a Mushi Mushi project.

  • By hand: create a free account  (no card) and create a project. The panel that opens shows the project ID and an API key that starts with mushi_. Copy the key now: it is shown once. You can mint another under Set up → Test it → Generate API key.
  • Self-hosting? Your own console gives you the same two values. See Self-hosting.

They go into the config in the Initialize step below.

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 Mushi reports with Mushi.shared.setMetadata(_:value:).

Full API: MushiMushi (iOS).

Last updated on