Swift Package Manager (SPM)

Integrate Sentry into your Xcode project using Swift Package Manager (SPM).

To integrate Sentry into your Xcode project using Swift Package Manager (SPM), open your App in Xcode and open File > Add Packages. Then add the SDK by entering the git repo url in the top right search field:

Copied
https://github.com/getsentry/sentry-cocoa.git

You can define your dependency rule by selecting the SDK version (or branch), and then click the "Add Package" button. You will then be prompted to choose one of the options Sentry, Sentry-Dynamic or SentrySwiftUI.

  • Sentry is the static framework, which is the recommended option if you prefer a fast app start time.
  • Sentry-Dynamic is the dynamic framework.
  • SentrySwiftUI is used to track performance of SwiftUI views, see more information in the docs.

Xcode allows you to choose many options, but you should choose only one of the options above.

Alternatively, when your project uses a Package.swift file to manage dependencies, you can specify the target with:

Copied
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.39.0"),

Version tags or branches need to have the Package.swift file in it or Xcode won't be able to install the package. This means versions previous to 4.4.3 cannot be installed using SPM.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").