Integrations
Swiftpatch emits lifecycle breadcrumbs (update-check, download, signature verify, slot commit, rollback, patch apply, boot counter) that you can forward to any crash-reporting or observability tool. The SDK ships one-line adapters for the three popular vendors and a vendor-neutral breadcrumb API for everything else.
Sentry
import * as Sentry from '@sentry/react-native';
import { installSentrySink } from '@swiftpatch/react-native/integrations/sentry';
// During your app bootstrap
Sentry.init({ dsn: '...' });
installSentrySink(Sentry);
Every Swiftpatch lifecycle event is forwarded to Sentry as a breadcrumb with the correct category, level, data, and timestamp. When a Sentry error is reported, you'll see the full Swiftpatch context leading up to it.
Bugsnag
import Bugsnag from '@bugsnag/react-native';
import { installBugsnagSink } from '@swiftpatch/react-native/integrations/bugsnag';
Bugsnag.start({ apiKey: '...' });
installBugsnagSink(Bugsnag);
Uses Bugsnag.leaveBreadcrumb with type 'manual' (the safe catch-all).
Firebase Crashlytics
import crashlytics from '@react-native-firebase/crashlytics';
import { installCrashlyticsSink } from '@swiftpatch/react-native/integrations/fabric';
installCrashlyticsSink(crashlytics());
Each breadcrumb lands in the Crashlytics timeline via log(). Error-level breadcrumbs additionally call recordError() so they appear in the non-fatal dashboard.
Custom breadcrumb sink
The three vendor adapters are thin wrappers around a generic API. For any other telemetry backend, register your own sink:
import { SwiftPatch } from '@swiftpatch/react-native';
const sp = new SwiftPatch({ deploymentKey: 'dep_xxx' });
await sp.init();
const unsub = sp.addBreadcrumbSink((crumb) => {
myTelemetry.log({
category: crumb.category, // e.g. 'swiftpatch.download'
level: crumb.level, // 'debug' | 'info' | 'warning' | 'error'
message: crumb.message,
data: crumb.data, // { key: string | number | boolean }
ts: crumb.timestamp, // ms since epoch
});
});
// Later — e.g. on logout
unsub();
Emit your own breadcrumbs to correlate app events with Swiftpatch's feed:
sp.breadcrumb('info', 'user_tapped_update_now', { releaseId: 'r_abc' });
Breadcrumb categories
Every crumb is tagged with a category so you can filter or route them:
| Category | Emitted when |
|---|---|
swiftpatch.init | SDK initialization, config load, native-module startup. |
swiftpatch.check | Update-check request / response. |
swiftpatch.download | Download start, progress ticks, completion. |
swiftpatch.verify | Signature verification, hash check. |
swiftpatch.patch | Delta-patch apply, fallback-to-full. |
swiftpatch.slot | Slot commit, promotion, stabilization. |
swiftpatch.rollback | Auto-rollback, manual rollback. |
swiftpatch.boot | Boot counter, crash detection, mount marker. |
What gets forwarded
Every event on the event bus is mirrored as a breadcrumb. For full event details, see Events.
High-value crumbs to watch for in your crash reports:
swiftpatch.verifywith levelerror— signature verification failed, bundle rejected.swiftpatch.rollback— device reverted to the previous slot.swiftpatch.boot— boot counter tripped, fallback to binary slot.swiftpatch.patchwithbytesSaved— delta-patch success (useful for bandwidth savings dashboards).swiftpatch.patchwithPATCH_FALLBACK_TO_FULL— delta path failed, fell back to full.
Crash correlation pattern
When a user crashes, you want to see what Swiftpatch did in the minutes leading up to it. The breadcrumb trail gives you that context:
[19:42:01] swiftpatch.check check-for-update hit
[19:42:02] swiftpatch.check new release: r_xyz (v1.2.3)
[19:42:02] swiftpatch.download download-started hash=abc123 size=412KB
[19:42:04] swiftpatch.verify signature OK
[19:42:04] swiftpatch.verify hash OK
[19:42:04] swiftpatch.slot commit NEW slot
[19:42:04] user tapped apply_now
[19:42:05] swiftpatch.boot mount marker set
[19:42:07] ERROR TypeError: Cannot read property 'x' of undefined
The crash landed on bundle r_xyz. The boot counter will notice and auto-rollback on the next cold start. The incident in the dashboard will group this error under the release.
Next steps
- Events — the full event bus, including error events.
- Error codes — every code the SDK can emit.
- Crash detection — how the SDK detects, clusters, and auto-heals.