Swiftpack.co - Package - crisp-im/crisp-sdk-ios

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

crisp-im/crisp-sdk-ios

:package: Crisp iOS SDK, add a chat in any iOS app and communicate with your users.

Crisp

Chat with app users, integrate your favorite tools, and deliver a great customer experience.

Crisp iOS SDK

Crisp screenshot

CocoaPods Twitter

How to use

1. Install Crisp iOS SDK

Option 1: Using SwiftPM

To use the Crisp iOS SDK with SPM, add a dependency to your Package.swift file:

let package = Package(
  dependencies: [
    .package(url: "https://github.com/crisp-im/crisp-sdk-ios.git", ...)
  ]
)

Option 2: Using CocoaPods

Add Crisp to your Podfile:

use_frameworks!

target :YourTargetName do
  pod 'Crisp'
end

Then run pod install

Option 3: Manual installation

  1. Download and extract the Crisp iOS SDK.
  2. Drag the Crisp.xcframework into your project, select Copy items if needed in the following dialog and click Finish.
Drag framework to project Copy items if needed
  1. Finally, configure the Crisp.xcframework to Embed & Sign in the Frameworks, Libraries, and Embedded Content section of your app's target settings.
Embed and Sign

2. Update your Info.plist

To enable your users to take and upload photos to the chat as well as download photos to their photo library, add the Privacy - Camera Usage Description (NSCameraUsageDescription) and Privacy - Photo Library Additions Usage Description (NSPhotoLibraryAddUsageDescription) to your app's Info.plist.

Update Info.plist

3. Configure the Crisp iOS SDK

Go to your Crisp dashboard (https://app.crisp.chat), copy your website id from the resulting URL and configure the CrispSDK in your app's AppDelegate.

Copy website id Configure CrispSDK
import Crisp

// In your func application()
CrispSDK.configure(websiteID: "YOUR_WEBSITE_ID")

4. Present the ChatViewController

Present ChatViewController
import Crisp

class ViewController: UIViewController {
    @IBAction func startChat(_ sender: Any) {
        self.present(ChatViewController(), animated: true)
    }
}

API Usage (Swift):

  • CrispSDK.setTokenID(tokenID: "A_CUSTOM_ID") Assigns session with a token_id

  • CrispSDK.user.email = "john.doe@gmail.com" Sets user email

  • CrispSDK.user.nickname = "John Name" Sets user name

  • CrispSDK.user.phone = "003370123456789" Sets user phone

  • CrispSDK.user.avatar = URL(string: "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0_400x400.jpg") Sets user avatar

  • CrispSDK.user.company = Company(name: "Acme", url: nil, companyDescription: nil, employment: nil, geolocation: nil) Sets user compay

  • CrispSDK.session.setString("custom_value", forKey: "custom_key") Sets session data string

  • CrispSDK.session.setInt(42, forKey: "custom_key") Sets session data int

  • CrispSDK.session.pushEvent(SessionEvent(name: "Signup", color: SessionEventColor.blue)) Sets Sends an event

  • CrispSDK.session.segment = "app" Sets session segment

  • CrispSDK.session.reset() Reset session

Credits

Crisp iOS SDK is owned and maintained by Crisp IM, SARL. You can chat with us on crisp or follow us on Twitter at Crisp_im

License

Crisp iOS SDK is under Copyright license. see LICENSE for more details.

Github

link
Stars: 27
Last commit: 1 week ago

Releases

1.0.12 - 2021-02-25T15:58:53

  • implemented defaults for values which might be absent in server responses