Swiftpack.co - MindscapeHQ/raygun4apple as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MindscapeHQ.
MindscapeHQ/raygun4apple v1.3.10
Raygun4Apple provider supporting iOS, tvOS and macOS.
⭐️ 0
🕓 1 year ago
iOS macOS tvOS
.package(url: "https://github.com/MindscapeHQ/raygun4apple.git", from: "v1.3.10")

Raygun4Apple

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.

Installation

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: [
        .executableTarget(
            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.enableCrashReporting()
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"
                                  withTags:@[@"Test"]
                            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:@"[email protected]"
                                                   withEmail:@"[email protected]"
                                                withFullName:@"Ronald Raygun"
                                               withFirstName:@"Ronald"];
RaygunClient.sharedInstance.userInformation = userInfo;

Documentation

For more information please visit our public documentation here.

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2.0.0
1 year ago

Changes

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

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics