MCPInstall

sentry-ios-swift-setup

by getsentry OfficialMobile

Setup Sentry in iOS/Swift apps. Use when asked to add Sentry to iOS, install sentry-cocoa SDK, or configure error monitoring for iOS applications using Swift and SwiftUI.

Installs
97
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/getsentry/sentry-agent-skills --skill sentry-ios-swift-setup
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads sentry-ios-swift-setup automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Sentry iOS Swift Setup

Install and configure Sentry in iOS projects using Swift and SwiftUI.

Invoke This Skill When

  • User asks to "add Sentry to iOS" or "install Sentry" in a Swift app
  • User wants error monitoring, tracing, or session replay in iOS
  • User mentions "sentry-cocoa" or iOS crash reporting

Important: The configuration options and code samples below are examples. Always verify against docs.sentry.io before implementing, as APIs and defaults may have changed.

Requirements

  • iOS 15.0+, macOS 12.0+, tvOS 15.0+, watchOS 8.0+

Install

Swift Package Manager (Recommended)

  1. File > Add Package Dependencies
  2. Enter: https://github.com/getsentry/sentry-cocoa.git
  3. Select version rule: "Up to Next Major" from 9.5.0

SPM Products: Choose based on your needs:

ProductUse Case
SentryDefault (static linking)
Sentry-DynamicDynamic framework
SentrySwiftUISwiftUI view performance tracking
Sentry-WithoutUIKitOrAppKitApp extensions or CLI tools

CocoaPods

# Podfile
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '9.5.0'

Then run pod install.

Configure

SwiftUI App

import SwiftUI
import Sentry

@main
struct YourApp: App {
    init() {
        SentrySDK.start { options in
            options.dsn = "YOUR_SENTRY_DSN"
            options.debug = true
            
            // Tracing
            options.tracesSampleRate = 1.0
            
            // Profiling
            options.configureProfiling = {
                $0.sessionSampleRate = 1.0
                $0.lifecycle = .trace
            }
            
            // Session Replay
            options.sessionReplay.sessionSampleRate = 1.0
            options.sessionReplay.onErrorSampleRate = 1.0
            
            // Logs (SDK 9.0.0+; for 8.55.0-8.x use options.experimental.enableLogs)
            options.enableLogs = true
            
            // Error context
            options.attachScreenshot = true
            options.attachViewHierarchy = true
        }
    }
    
    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

UIKit App

import UIKit
import Sentry

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        SentrySDK.start { options in
            options.dsn = "YOUR_SENTRY_DSN"
            options.debug = true
            options.tracesSampleRate = 1.0
            options.enableLogs = true
        }
        return true
    }
}

Configuration Options

OptionDescriptionDefault
dsnSentry DSNRequired
tracesSampleRate% of transactions traced0
sessionReplay.sessionSampleRate% of sessions replayed0
sessionReplay.onErrorSampleRate% of error sessions replayed0
enableLogsSend logs to Sentryfalse
attachScreenshotAttach screenshot on errorfalse
attachViewHierarchyAttach view hierarchy on errorfalse

Auto-Instrumented Features

FeatureWhat's Captured
App LaunchesCold/warm start times
NetworkURLSession requests
UIUIViewController loads, user interactions
File I/ORead/write operations
Core DataFetch/save operations
FramesSlow and frozen frame detection

Logging

let logger = SentrySDK.logger

logger.info("User action", attributes: [
    "userId": "123",
    "action": "checkout"
])

// Log levels: trace, debug, info, warn, error, fatal

Session Replay

iOS 26+ / Xcode 26+ caveat: SDK 8.57.0+ automatically disables Session Replay on iOS 26.0+ when built with Xcode 26.0+ due to Apple's Liquid Glass rendering breaking masking reliability. Replay still works on iOS < 26 or Xcode < 26. To force-enable (use with caution): options.experimental.enableSessionReplayInUnreliableEnvironment = true.

Masking

// SwiftUI modifiers
Text("Safe content").sentryReplayUnmask()
Text(user.email).sentryReplayMask()

User Context

let user = User()
user.userId = "user_123"
user.email = "user@example.com"
SentrySDK.setUser(user)

// Clear on logout
SentrySDK.setUser(nil)

Verification

// Test error capture
SentrySDK.capture(message: "Test from iOS")

// Or trigger a test error
do {
    try someFailingFunction()
} catch {
    SentrySDK.capture(error: error)
}

Production Settings

SentrySDK.start { options in
    options.dsn = "YOUR_SENTRY_DSN"
    options.debug = false
    options.tracesSampleRate = 0.2  // 20%
    options.sessionReplay.sessionSampleRate = 0.1  // 10%
    options.sessionReplay.onErrorSampleRate = 1.0  // 100% on error
    options.enableLogs = true
}

Size Analysis (Fastlane)

Track app bundle size with Sentry using the Fastlane plugin.

Install Plugin

bundle exec fastlane add_plugin fastlane-plugin-sentry

Configure Authentication

# Environment variable (recommended for CI)
export SENTRY_AUTH_TOKEN=your_token_here

Or create .sentryclirc (add to .gitignore):

[auth]
token=YOUR_SENTRY_AUTH_TOKEN

Fastfile Lane

lane :sentry_size do
  build_app(
    scheme: "YourApp",
    configuration: "Release",
    export_method: "app-store"
  )

  sentry_upload_build(
    org_slug: "your-org",
    project_slug: "your-project",
    build_configuration: "Release"
  )
end

Run Size Analysis

bundle exec fastlane sentry_size

View results in the Sentry UI after the upload completes.

Troubleshooting

IssueSolution
Events not appearingCheck DSN, enable debug = true
No tracesSet tracesSampleRate > 0
No replaysSet sessionSampleRate > 0, check SDK 8.31.1+. On iOS 26+/Xcode 26+ see Liquid Glass caveat above
No logsSet enableLogs = true (SDK 9.0.0+) or experimental.enableLogs = true (SDK 8.55.0-8.x)
CocoaPods failsRun pod repo update, check iOS 15+ target
Size upload failsCheck SENTRY_AUTH_TOKEN, verify org/project slugs

FAQ

What does the sentry-ios-swift-setup skill do?

Setup Sentry in iOS/Swift apps. Use when asked to add Sentry to iOS, install sentry-cocoa SDK, or configure error monitoring for iOS applications using Swift and SwiftUI.

How do I install sentry-ios-swift-setup?

Run npx skills add https://github.com/getsentry/sentry-agent-skills --skill sentry-ios-swift-setup in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sentry-ios-swift-setup/ (personal) or .claude/skills/sentry-ios-swift-setup/ (project).

Which AI agents can use sentry-ios-swift-setup?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is sentry-ios-swift-setup safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains sentry-ios-swift-setup?

It is published by getsentry in getsentry/sentry-agent-skills, and it is an official skill from the maker of the technology it covers. It has 97 recorded installs.

More from getsentry/sentry-agent-skills

View all →

sentry-fix-issues

getsentry/sentry-agent-skills

Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.

OfficialDevOps & Cloud2.6K installs

sentry-react-setup

getsentry/sentry-agent-skills

Setup Sentry in React apps. Use when asked to add Sentry to React, install @sentry/react, or configure error monitoring, error boundaries, session replay, or browser tracing for React applications.

OfficialDevOps & Cloud1.1K installs

sentry-setup-ai-monitoring

getsentry/sentry-agent-skills

Setup Sentry AI Agent Monitoring in any project. Use when asked to monitor LLM calls, track AI agents, or instrument OpenAI/Anthropic/Vercel AI/LangChain/Google GenAI/Pydantic AI. Detects installed AI SDKs and configures appropriate integrations.

OfficialDevOps & Cloud894 installs

sentry-nextjs-sdk

getsentry/sentry-agent-skills

Full Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, logging, profiling, AI monitoring, or crons for Next.js applications. Supports Next.js 13+ with App Router and Pages Router.

OfficialDevOps & Cloud653 installs

sentry-pr-code-review

getsentry/sentry-agent-skills

Review a project's PRs to check for issues detected in code review by Seer Bug Prediction. Use when asked to review or fix issues identified by Sentry in PR comments, or to find recent PRs with Sentry feedback.

OfficialCode Quality & Workflow632 installs

sentry-create-alert

getsentry/sentry-agent-skills

Create Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.

OfficialDevOps & Cloud592 installs

Popular mobile skills

View category →

design-mobile-apps

designed-by-ai/skills

Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.

Mobile1.1M installs

ios-design

uizze.sh

Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.

Mobile416.5K installs

vercel-react-native-skills

vercel-labs/agent-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

OfficialMobile256.7K installs

animate-expo

emilkowalski/skills

Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.

Mobile140.1K installs

xcode-project-setup

firebase/agent-skills

Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).

OfficialMobile131.2K installs

firebase-remote-config-basics

firebase/agent-skills

Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.

OfficialMobile121.7K installs