Swiftpack.co - Forethought-Technologies/solve-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Forethought-Technologies.
Forethought-Technologies/solve-ios 0.3.0
Contains the public XCframework
⭐️ 1
🕓 24 weeks ago
iOS
.package(url: "https://github.com/Forethought-Technologies/solve-ios.git", from: "0.3.0")

Forethought - Solve iOS SDK

This repository contains the framework and instructions for the Forethought iOS SDK.

You will need a valid API key in order to use the Forethought Solve SDK. In additon to the instructions below, you can also view sample apps written in Objective-C & Swift, as well as a custom implementation for SwiftUI.

Installation

Swift Package Manager

  1. Swift Package Manager is included with Xcode. To use Forethought with your iOS application, simply open your Xcode project and select File > Add Packages.

  2. Enter the Forethought iOS GitHub repo URL (https://github.com/Forethought-Technologies/solve-ios)

  3. Tap Add Package. Follow the remaining prompts and Xcode will automatically download the framework

Cocoapods

  1. Forethought is also available through CocoaPods. If you have not yet installed Cocoapods, follow their guide to install and create a Podfile here.

  2. In your Podfile, add the following line:

    pod 'Forethought'
    
  3. Run the following command:

    $ pod install
    
  4. Make sure to use the .xcworkspace file and NOT the .xcodeproj from now on.

Usage

  1. In your AppDelegate.swift file, add the following lines:
      ForethoughtSDK.start(apiKey: "__YOUR_KEY_HERE__")
    
  2. When you'd like to call the Forethought SDK, add the following:
      //At the top of your file
    import 'Forethought'
      
      //Inside of your class
    @IBAction func contactSupportTapped() {
        ForethoughtSDK.show()
    }
    
  3. Replace __YOUR_KEY_HERE__ with your API key you received from Forethought

Optional Additions

Custom Data and Config Parameters

You can send custom parameters that you define directly with Forethought like this:

  ForethoughtSDK.configParameters = ["exampleConfigKey": "exampleConfigValue"]
ForethoughtSDK.dataParameters = ["language":"EN", "tracking-email":"test@ft.ai"]

Use of a Navigation Controller Directly

You can also attach the Forethought SDK directly onto your navigation stack, like this:

@IBAction func contactSupportTapped() {
    ForethoughtSDK.show(fromNavigationController: self.navigationController)
}

Plugins

To attach Forethought to another chat provider, such as Zendesk or Kustomer, please check out our plugin documentation.

Custom Handoff Methods

If you'd like to handoff Forethought chat to another provider, you can do so by implementing the following:

  1. Set a delegate to your Forethought SDK. Do this before presenting the screen:

    ForethoughtSDK.delegate = self
    
  2. Make sure that the object that you set conforms to the ForethoughtDelegate protocol

    class ViewController: UIViewController, ForethoughtDelegate {
    
  3. Have your object conform to ForethoughtDelegate by adding a single method

    func startChatRequested(handoffData: ForethoughtHandoffData) {
       print("Chat Requested: \(handoffData)")
    }
    
  4. Add your custom implementation here. You can inspect and view the handoffData object to access history of the previous chat.

Documentation

Documentation has been provided as a .doccarchive to enable full documentation directly inside Xcode. To use, simply double-click on Forethought.doccarchive, and Xcode will handle the rest.

GitHub

link
Stars: 1
Last commit: 15 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

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