Skip to content

Latest commit

 

History

History
134 lines (94 loc) · 5.1 KB

README.md

File metadata and controls

134 lines (94 loc) · 5.1 KB

Table of contents

Requirements

  • Latest stable Xcode from the App Store, 14.0 or later.
  • Swift 5.7 or later.
  • Minimum deployment target iOS 15.

Setup

You can integrate the DevRev SDK in your project as a Swift Package Manager (SPM) package.

Open your project in Xcode, go to the Add Package screen, add the following URL under Enter Package URL:

https://github.com/devrev/devrev-sdk-ios

Make sure you link the framework under the Build Phases screen of your app target. Find the Link Binary With Libraries phase and make sure that DevRevSDK is linked there.

Now you should be able to import and use the DevRev SDK.

Setting up the DevRev SDK

Step 1: Credentials

Open the Support settings page, then go to PLuG Setup.

On the PLuG Setup page, you will be able to create your SDK credentials (app ID and secret).

Step 2: Initialization

Once you have the credentials, you can configure the DevRev SDK in your app. The SDK will be initialized once you have called the configuration method:

DevRev.configure(appID: appID, secret: secret, organizationSlug: organizationSlug)

UIKit apps

Configure the SDK in the AppDelegate.application(_:didFinishLaunchingWithOptions:) method.

SwiftUI apps

Depending on the architecture of your app, you will need to configure the SDK at your entry point or initial view of the app.

Features

Identification

Certain features of the SDK require a user identification. Make sure that you identify the user using the DevRev.identify(...) function.

The function accepts the DevRev.Identification structure, with the user ID (userID) as the only required property, all other properties are optional.

The call would look something like this:

await DevRev.identify(Identification(userID: "[email protected]"))

The identification function should be placed at the appropriate place in your app after you login your user. If you have the user information at app launch, call the function after the DevRev.configure(...) method.

PLuG support chat

UIKit

The support chat feature can be shown as a modal screen or pushed to a navigation stack.

The following overloaded method will show the support screen:

DevRev.showSupport(from:isAnimated:)
  1. If a UIViewController is passed as the from parameter, then the screen will be shown modally.
  2. If a UINavigationController is passed as the from parameter, then the screen will be pushed onto the stack.

SwiftUI

For SwiftUI apps we provide a specific view, you just need to use the public view property:

DevRev.supportView

Example



Sample app

A sample app with use cases for both UIKit and SwiftUI has been provided as part of this repository.

Before you start using the sample app you will need to configure it to be used with your Apple Developer team and your DevRev credentials. For your convenience the code has been marked with compiler error directives (#error) at the places that need attention.

  1. Add your credentials to ContentView.swift (SwiftUI) or AppDelegate.swift (UIKit).
    • After you have added the credentials, delete or comment out the compiler error lines in the respective files.
  2. Configure the code signing for the sample target:
    • Open the project settings (1),
    • Select the appropriate target (2),
    • Go to the Signing & Capabilities section (3), and
    • Select your development team under Team (4).

Troubleshooting

Cannot import the SDK into my app

Check the Setup again and make sure that DevRevSDK is properly linked.

How does the DevRev SDK handle errors?

The DevRev SDK outputs all errors in the console using Apple's Unified Logging System under the subsystem ai.devrev.sdk.

Why won't the support chat show?

Make sure you have called the identification method (DevRev.identify(...)) properly.