Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
crisp-im/crisp-sdk-ios
Chat with app users, integrate your favorite tools, and deliver a great customer experience.
Crisp iOS SDK

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
- Download and extract the Crisp iOS SDK.
- Drag the
Crisp.xcframework
into your project, selectCopy items if needed
in the following dialog and clickFinish
.


- Finally, configure the
Crisp.xcframework
toEmbed & Sign
in theFrameworks, Libraries, and Embedded Content
section of your app's target settings.

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.

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
.


import Crisp
// In your func application()
CrispSDK.configure(websiteID: "YOUR_WEBSITE_ID")
4. Present the 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 |
You may find interesting
Releases
1.0.12 - 2021-02-25T15:58:53
- implemented defaults for values which might be absent in server responses