What's New




  • Creation of Package.swift file for the Swift Package Manager


Raygun provider for iOS, tvOS & macOS supporting Crash Reporting and Real User Monitoring.

Officially Supports:

  • iOS 12+
  • tvOS 12+
  • macOS 12+

Note: raygun4apple may work with earlier OS versions, however we recommend updating to the versions we build and test for to avoid experiencing any unexpected issues.


Using the Swift Package Manager

To integrate Raygun into an SPM managed application, update your Package.swift file to include raygun4apple as a dependency.

Here is an example of a macOS CLI application which uses raygun4apple as a dependency:

import PackageDescription

let package = Package(
    name: "macos-cli",
    dependencies: [
        //Note - the version must be atleast 2.0.0 as this is earliest release of this package through SPM.
        .package(url: "https://github.com/MindscapeHQ/raygun4apple.git", from: "2.0.0"),
    targets: [
            name: "macos-cli",
            dependencies: ["raygun4apple"])

Configuring the Raygun client

The configuration step is slightly different if installed via the Swift package manager. Rather than importing the specific header for the target application, simply import raygun4apple.

Here is an example which imports raygun4apple, initializes the provider, and sends a test exception.

import raygun4apple

let raygunClient = RaygunClient.sharedInstance(apiKey: "YOUR_API_KEY_HERE")
raygunClient.send(exception: NSException.init(name: NSExceptionName.illegalSelectorException, reason: "This is a macOS error!"))

With CocoaPods

To integrate Raygun using CocoaPods, update your Podfile to include:

pod 'raygun4apple'

Once updated you can run pod install from Terminal.

With GitHub releases

The latest release can be found here. The frameworks are attached to each release as a zipped file. This can be downloaded, unzipped and included in you project directory.

Once included, go to your app's target General settings and add the raygun4apple framework to the Frameworks, Libraries, and Embedded Content section. Ensure that the framework is set to Embed & Sign.

Configuring the Raygun client

In your AppDelegate class file, import the header for your target platform.

#import <raygun4apple/raygun4apple_iOS.h>

Initialize the Raygun client by adding the following snippet to your AppDelegate application:didFinishLaunchingWithOptions method:

[RaygunClient sharedInstanceWithApiKey:@"_INSERT_API_KEY_"];
[RaygunClient.sharedInstance enableCrashReporting];
[RaygunClient.sharedInstance enableRealUserMonitoring];
[RaygunClient.sharedInstance enableNetworkPerformanceMonitoring]; // Optional

Sending a test error event

To ensure that the Raygun client is correctly configured, try sending a test crash report with the following snippet.

[RaygunClient.sharedInstance sendException:@"Raygun has been successfully integrated!"
                                withReason:@"A test crash report from Raygun"
                            withCustomData:@{@"TestMessage":@"Hello World!"}];

Set up Customers

By default, each user will be identified as an anonymous user/customers. However you can set more detailed customer information with the following snippet.

RaygunUserInformation *userInfo = nil;
userInfo = [[RaygunUserInformation alloc] initWithIdentifier:@"ronald@raygun.com"
                                                withFullName:@"Ronald Raygun"
RaygunClient.sharedInstance.userInformation = userInfo;


For more information please visit our public documentation here.


  • Swift Tools 5.6.0
View More Packages from this Author


  • None
Last updated: Wed May 24 2023 15:08:04 GMT-0500 (GMT-05:00)