Adding the Talk SDK
Adding the Talk SDK
You can add the Talk SDK to your project using one of the following methods:
- Adding the SDK using Swift Package Manager
- Adding the SDK using CocoaPods
- Adding the SDK using Carthage
- Adding the SDK manually
The Talk SDK requires microphone access for making a voice call. Whatever method you choose to add the SDK, also check the usage descriptions in the Info.plist file for microphone access.
Adding the SDK using Swift Package Manager
Swift Package Manager is a dependency manager for managing and distributing Swift code and is integrated with the Swift build system. Starting with Xcode 11, you can use Swift Package Manager inside Xcode.
To add the Talk SDK to you project, follow the Apple developer documentation on adding a package dependency.
Provide the repository URL https://github.com/zendesk/talk_sdk_ios
and follow Xcode's instructions to add the Talk SDK as a dependency. Swift Package Manager will resolve any required dependencies and download them as needed.
Adding the SDK using CocoaPods
CocoaPods is a dependency manager that lets you add third-party frameworks and libraries to projects. For installation instructions, see Install CocoaPods.
If not already done, create a Podfile for your project as follows:
-
In Terminal, navigate to the top-level folder of your project (the one with the xcodeproj file).
-
Create a Podfile using the
pod init
command. -
Add the
ZendeskTalkSDK
pod to your Podfile.target 'My Sample App' do
pod 'ZendeskTalkSDK'
end
Note: If you're using Objective-C, you'll need to include
use_frameworks!
. -
Run the
pod install
command.
Because your project now contains a dependency managed by CocoaPods, you must open the project in Xcode by double-clicking the .xcworkspace file, not .xcodeproj.
For more information, see Using CocoaPods on cocoapods.org.
Adding the SDK using Carthage
Carthage is a third-party dependency manager for iOS applications. For installation and usage instructions, see Installing Carthage in the Carthage readme on Github.
-
Add the following lines to your Cartfile to import the necessary frameworks for working with the UI we provide:
# The main Talk SDK frameworks
binary "https://raw.githubusercontent.com/zendesk/talk_sdk_ios/release/ZendeskTalkSDK.json" == 3.0.0
# Shared Zendesk frameworks
binary "https://zendesk.jfrog.io/zendesk/libs-releases-local/ios/zendesk/ZendeskCoreSDK/ZendeskCoreSDK.json" == 2.5.1
# Twilio library
binary "https://raw.githubusercontent.com/twilio/twilio-voice-ios/Releases/twilio-voice-ios.json" == 6.9.1
-
Run the
carthage update --use-xcframeworks
command. -
On your target's General tab, drag each of the following frameworks from the Carthage/Build/iOS folder to the Frameworks, Libraries and Embedded Content section and embed the frameworks by selecting Embed & Sign option:
- TalkSDK.xcframework
- ZendeskCoreSDK.xcframework
- TwilioVoice.xcframework
Note: Your app's build targets must point the
FRAMEWORK_SEARCH_PATHS
setting to theCarthage/Build/iOS
folder.
Adding the SDK manually
-
Download the XCFramework ZIP files from the latest release on the Zendesk Talk SDK repo and from the version 2.5.1 release on the Zendesk Core SDK repo on Github and unzip the files on your hard drive.
-
In Xcode, select your project in Project navigator:
-
In Finder, navigate to where you extracted the SDKs.
-
Drag the following items into the Embedded Binaries section of your project.
- TalkSDK.xcframework
- ZendeskCoreSDK.xcframework
-
Set the Add Files options as follows:
- Destination - select Copy items if needed
- Added folders - select Create groups
-
Install release version 6.9.1 of the Twilio Voice iOS SDK by following the manual installation instruction described in the Twilio docs.