Skip to content

triceam/Watson-iOS-SDK-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watson-iOS-SDK-Demo

This project contains a simple application that demonstrates how to setup & integrate the IBM Watson iOS SDK (beta) into your iOS applications.

Getting Started

The IBM Watson iOS SDK (beta) helps simplify integration with many of the Watson Developer Cloud services, including the IBM Watson Dialog, Language Translation, Natural Language Classifier, Personality Insights, Speech To Text, Text to Speech, Alchemy Language, or Alchemy Vision services – all of which are available today, and can now be integrated with just a few lines of code.

Setup the Services

In order to take advantage of the IBM Watson iOS SDK (beta), you must first setup IBM Watson services on Bluemix that the mobile SDK will leverage.

This sample app is leveraging the IBM Watson Language Translation service

  1. Head over to IBM Bluemix and create a new application. Choose the runtime for Node.js as your base.
  2. Next you need to add the Watson Language Translation Service to the app you just created. From the app dashboard, select "Add Service or API" and add the Language Translation Service to your app.

Swift-Translator app on IBM Bluemix

Get the SDK

Next you need to get download the IBM Watson iOS SDK (beta). You can either download it directly as a zip file, or you can clone the git repository to your local machine. Follow installation instructions to compile the SDK for use on your own machine.

Setup the Client App

Now we need to pull the SDK into the app so we can start integrating Watson services.

  1. Download or clone the contents of this repo to your local machine.
  2. Open the Translator.xcodeproj project file in Xcode.
  3. Drag the WatsonDeveloperCloud.xcodeproj from the SDK you just downloaded into the Xcode project navigator (left side bar).
    Swift-Translator project navigator
  4. You will be prompted to create a workspace. Do it.
  5. Compile the WatsonDeveloperCloud target
  6. Update the "Translator" target and add a link to the WatsonDeveloperCloud.framework
    Swift-Translator project navigator
  7. Next, Compile and run the Translator project to launch it in the iOS Simulator

Swift-Translator app in the iOS Simulator

Integration of Watson Services

Integration of Watson services is as simple as creating an instance of the service class you want to use, then calling the methods that are exposed through the IBM Watson iOS SDK (beta).

For example, the entire sample app code inside of ViewController.swift is less than 100 lines of code, and most of that is even whitespace.

Integration of the IBM Watson Language Translation service is shown below:

let translation = LanguageTranslation(username:"your username", password: "your password")

translation.translate([inputText!], source: "en", target: model.target!) { text, error in
    let translation = text![0]
    print(translation)
}

Feel free to explore this project, and be sure to explore the IBM Watson iOS SDK (beta).

About

A simple demo application that shows how to setup & integrate the IBM Watson iOS SDK into your iOS applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages