This repository contains an example application to demonstrate the Watson Developer Cloud Swift SDK. It combines the Speech to Text, Conversation, and Text to Speech services to build a voice-to-voice chat app.
If you'd prefer to learn by building this app yourself, feel free to follow along with the tutorial.
To run the sample playground or iOS app, be sure to clone the repository and download the Watson Developer Cloud Swift SDK dependency. The dependency will be loaded twice, once as a Git submodule (for use in the playground) and again with Carthage (for use in the iOS app).
$ git clone https://github.com/watson-developer-cloud/simple-chat-swift.git
$ cd simple-chat-swift/simple-chat
$ git submodule init
$ git submodule update
$ carthage update --platform iOS
The sample playground and iOS app both use the Speech to Text, Conversation, and Text to Speech services. Each service must be provisioned. You will need to sign up for a Bluemix account if you do not already have one.
To provision each service:
- Open the Bluemix services dashboard.
- Select the "Create Service" button.
- Select the "Watson" category from the left-hand menu.
- Select the service to provision.
- Select "Create" to continue. (The default configuration options are fine for this tutorial.)
Each of the services you provisioned has its own username and password credentials. The playground and iOS app expect to find these credentials in a Credentials.swift
file.
Start by renaming the Credentials.swift.example
file in your project directory to Credentials.swift
. Then open Credentials.swift
in Xcode. This file will record our service credentials.
- Open the Bluemix services dashboard.
- Select the service whose credentials you would like to record.
- Select "Service credentials" from the left-hand navigation menu.
- Select "View credentials".
- Copy the username and password into
Credentials.swift
.
Repeat these steps to copy the username and password credentials for the Speech to Text, Conversation, and Text to Speech services.
Watson Developer Cloud:
Watson Swift SDK:
Swift@IBM: