Swift

Xcode Project & Workspace

You will be using the iOS Client SDK library inside an Xcode project you'll create next:

Create an Xcode Project

  • Open Xcode and, from the menu, select File > New > Project....

  • Select iOS as platform.

  • Select a App for the Application type and click Next.

  • For the Product Name type in VonageTutorialApp.

  • Select or add the relevant value for Team and Organisation Identifier. NB: If you don't possess that info, select None for Team and enter com.test for Organisation Identifier.

  • Use Storyboard for Interface and Swift for Language.

  • Ensure that both Use Core Data and Include Tests options are deselected. Click Next.

  • Select your project folder, vonage-tutorial as the place where your Xcode project will reside.

  • You now have a brand new Xcode Project.

IMPORTANT: Before continuing, please close the new project you created.

You will add the iOS Client SDK library to your project via CocoaPods.

Install CocoaPods

  • Open the Terminal app and navigate to the project folder by typing.
cd vonage-tutorial/VonageTutorialApp
  • Install CocoaPods in your system, if you don't have it already.
sudo gem install cocoapods

Note: CocoaPods is built with Ruby, available by default on macOS.

  • Create a Podfile for your project.
pod init

NOTE: If you are experiencing a FrozenError with Xcode 14, update the xcodeproj gem. See this GitHub issue for Cocoapods.

Add the iOS Client SDK

  • Add the Vonage iOS Client SDK to the Podfile. To do this, let's open it in Xcode.
open -a Xcode Podfile
  • Update the Podfile as shown below.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'VonageTutorialApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for VonageTutorialApp
  pod 'VonageClientSDKVoice', '1.2.1'
  
end
  • Install the library.
pod install

The latest version of the library will be added to your project:

Analyzing dependencies
Downloading dependencies
Installing VonageClientSDKVoice (x.y.z)
Installing VonageWebRTC (x.y.z)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.

Open the Workspace

As described in the output above, please use VonageTutorialApp.xcworkspace rather than the initial project from now on. To open it, type the following in the terminal.

open VonageTutorialApp.xcworkspace

NOTE: If you are using Xcode 15 you may need to turn off the ENABLE_USER_SCRIPT_SANDBOXING build setting. See this GitHub issue for Cocoapods.