Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…os-sdk into develop
  • Loading branch information
vherrin committed Dec 21, 2015
2 parents 34f2f21 + db177fb commit a744ca3
Show file tree
Hide file tree
Showing 24 changed files with 490 additions and 476 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/
Frameworks
Examples/authentication-backend-example/bin
Examples/authentication-backend-example/node_modules
Credentials_full.plist
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@ osx_image: xcode7.2
#xcode_scheme: WatsonDeveloperCloud
#xcode_sdk: iphonesimulator9.2

# whitelist
branches:
only:
- develop

#xcode_scheme: WatsonCore
before_install:
- brew update
- brew install carthage

- openssl aes-256-cbc -K $encrypted_1ae11c268751_key -iv $encrypted_1ae11c268751_iv -in WatsonDeveloperCloudTests/Credentials_full.plist.enc -out WatsonDeveloperCloudTests/Credentials.plist -d

before_script:
- carthage update --platform iOS
# after_success:
# - bash <(curl -s https://codecov.io/bash)

after_success:
- bash <(curl -s https://codecov.io/bash)

#script:
# - xcodebuild clean build -scheme WatsonDeveloperCloud -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES

script:
- xcodebuild clean build -scheme WatsonDeveloperCloud -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1'
- xcodebuild clean build test -scheme WatsonDeveloperCloud -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' -enableCodeCoverage YES
# - xctool -scheme WatsonDeveloperCloud build test -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We don't use GitHub as a support forum. For any usage questions that are not spe

# Reporting Issues

If you encounter a bug with the iOS Watson SDK, please submit a detailed [issue](https://github.com/IBM-MIL/Watson-iOS-SDK/issues) so that it can be addressed quickly. We always appreciate a well-written, thorough bug report.
If you encounter a bug with the Watson Developer Cloud iOS SDK, please submit a detailed [issue](https://github.com/IBM-MIL/Watson-iOS-SDK/issues) so that it can be addressed quickly. We always appreciate a well-written, thorough bug report.

Please check that the project issues database doesn't already include that problem or suggestion before submitting an issue. If you find a match, add a quick "+1" or "I have this problem too." Doing so helps prioritize the most common problems and requests.

Expand Down
4 changes: 2 additions & 2 deletions Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a quick walkthrough to demonstrate how to create an iOS app that uses Wa

Before beginning to create the iOS application, make sure you set up a BlueMix application and create a Text To Speech service. First, sign up for a Bluemix account. Next, create a new Bluemix application, it can either be Node JS or Liberty application (it does not matter in this example since we will not be deploying any server-side code). Next, setup an instance of the Watson Text to Speech service for that application. When a service gets bound to a Bluemix application, new credentials are automatically generated for making calls to the service. These credentials will be used as part of this getting started guide, and can be found once the service is started by clicking on the “Show Credentials” link on the service. For more information about creating Bluemix applications and attaching Bluemix and Watson services read [Bluemix getting started](https://developer.ibm.com/bluemix/#gettingstarted).

In addition, this quick guide uses Carthage to fetch the Watson iOS SDK and its dependencies. [Carthage](https://github.com/Carthage/Carthage) provides instruction for [Installing Carthage](https://github.com/Carthage/Carthage#installing-carthage).
In addition, this quick guide uses Carthage to fetch the Watson Developer Cloud iOS SDK and its dependencies. [Carthage](https://github.com/Carthage/Carthage) provides instruction for [Installing Carthage](https://github.com/Carthage/Carthage#installing-carthage).


###Create a Text to Speech App
Expand Down Expand Up @@ -120,4 +120,4 @@ github "watson-developer-cloud/ios-sdk"

You can review the different voices and languages [here](https://github.com/watson-developer-cloud/ios-sdk#text-to-speech).

You can download all the source code for the Watson iOS SDK [here](https://github.com/watson-developer-cloud/ios-sdk).
You can download all the source code for the Watson Developer Cloud iOS SDK [here](https://github.com/watson-developer-cloud/ios-sdk).
83 changes: 43 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
# Watson iOS SDK
# Watson Developer Cloud iOS SDK

[![Build Status](https://travis-ci.org/watson-developer-cloud/ios-sdk.svg?branch=master)](https://travis-ci.org/watson-developer-cloud/ios-sdk)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![codecov.io](https://codecov.io/github/watson-developer-cloud/ios-sdk/coverage.svg?branch=develop)](https://codecov.io/github/watson-developer-cloud/ios-sdk?branch=develop)
[![Docs](https://img.shields.io/badge/Docs-0.1-green.svg?style=flat)](http://watson-developer-cloud.github.io/ios-sdk/)
[![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg?style=flat)](https://developer.apple.com/swift/)

The Watson iOS SDK is a collection of services to allow developers to quickly add Watson Cognitive Computing services to their Swift iOS applications.
The Watson Developer Cloud iOS SDK is a collection of services to allow developers to quickly add Watson Cognitive Computing services to their Swift iOS applications.

Visit our [Quickstart Guide](Quickstart.md) to build your first iOS app with Watson!

> *The Watson iOS SDK is currently in beta.*
> *The Watson Developer Cloud iOS SDK is currently in beta.*
## Table of Contents
* [Installation](#installation)

* [IBM Watson Services](#ibm-watson-services)
- [Alchemy Language](#alchemy-language)
- [Alchemy Vision](#alchemy-vision)
- [Dialog](#dialog)
- [Language Translation](#language-translation)
- [Natural Language Classifier](#natural-language-classifier)
- [Personality Insights](#personality-insights)
- [Speech to Text](#speech-to-text)
- [Text to Speech](#text-to-speech)
- [Alchemy Language](#alchemy-language)
- [Alchemy Vision](#alchemy-vision)
- [Dialog](#dialog)
- [Language Translation](#language-translation)
- [Natural Language Classifier](#natural-language-classifier)
- [Personality Insights](#personality-insights)
- [Speech to Text](#speech-to-text)
- [Text to Speech](#text-to-speech)
* [Authentication](#authentication)
* [Building and Testing](#build--test)
* [Open Source @ IBM](#open-source--ibm)
* [License](#license)
* [Contributing](#contributing)

## Installation

The Watson iOS SDK requires third-party dependencies such as ObjectMapper and Alamofire. The dependency management tool Carthage is used to help manage those frameworks. There are two main methods to install Carthage. The first method is to download and run the Carthage.pkg installer. You can locate the latest release [here.](https://github.com/Carthage/Carthage/releases)

The Watson Developer Cloud iOS SDK requires third-party dependencies such as ObjectMapper and Alamofire. The dependency management tool Carthage is used to help manage those frameworks. The recommended version of Carthage is v0.11 or higher.

There are two main methods to install Carthage. The first method is to download and run the Carthage.pkg installer. You can locate the latest release [here.](https://github.com/Carthage/Carthage/releases)

The second method of installing is using Homebrew for the download and installation of carthage with the following commands

```shell
brew update && brew install carthage
```

Once the dependency manager is installed, the next step is to download the needed frameworks for the SDK to the project path. Make sure you are in the root of the project directory and run the following command.
Once the dependency manager is installed, the next step is to download the needed frameworks for the SDK to the project path. Make sure you are in the root of the project directory and run the following command. All of the frameworks can be found on the filesystem directory at location ./Carthage/Build/iOS/

``` shell
carthage update --platform iOS
Expand All @@ -48,19 +53,19 @@ For more details on using the iOS SDK in your application, please review the [Qu
**Frameworks Used:**

* [Alamofire](https://github.com/Alamofire/Alamofire)
* [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper)
* [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper)
* [AlamofireObjectMapper](https://github.com/tristanhimmelman/AlamofireObjectMapper/releases)
* [Starscream](https://github.com/daltoniam/Starscream)
* [HTTPStatusCodes](https://github.com/rhodgkins/SwiftHTTPStatusCodes)
* [XCGLogger](https://github.com/DaveWoodCom/XCGLogger)
* [HTTPStatusCodes](https://github.com/rhodgkins/SwiftHTTPStatusCodes)
* [XCGLogger](https://github.com/DaveWoodCom/XCGLogger)



## IBM Watson Services

**Getting started with Watson Developer Cloud and Bluemix**

The IBM Watson™ Developer Cloud (WDC) offers a variety of services for developing cognitive applications. Each Watson service provides a Representational State Transfer (REST) Application Programming Interface (API) for interacting with the service. Some services, such as the Speech to Text service, provide additional interfaces.
The IBM Watson™ Developer Cloud (WDC) offers a variety of services for developing cognitive applications. Each Watson service provides a Representational State Transfer (REST) Application Programming Interface (API) for interacting with the service. Some services, such as the Speech to Text service, provide additional interfaces.

IBM Bluemix™ is the cloud platform in which you deploy applications that you develop with Watson Developer Cloud services. The Watson Developer Cloud documentation provides information for developing applications with Watson services in Bluemix. You can learn more about Bluemix from the following links:

Expand Down Expand Up @@ -108,7 +113,7 @@ let alchemyLanguageInstance = AlchemyLanguage(tokenAuthenticationStrategy: token

API calls are instance methods, and model class instances are returned as part of our callback.

e.g.
e.g.

```swift

Expand Down Expand Up @@ -147,7 +152,7 @@ let alchemyVisionInstance = AlchemyVision(apiKey: String)

API calls are instance methods, and model class instances are returned as part of our callback.

e.g.
e.g.

```swift
serviceVision.recognizeFaces(VisionConstants.ImageFacesType.FILE,
Expand Down Expand Up @@ -256,13 +261,13 @@ The following links provide more information about the Natural Language Classifi

### Personality Insights

The IBM Watson™ Personality Insights service provides an Application Programming Interface (API) that enables applications to derive insights from social media, enterprise data, or other digital communications. The service uses linguistic analytics to infer personality and social characteristics, including Big Five, Needs, and Values, from text.
The IBM Watson™ Personality Insights service provides an Application Programming Interface (API) that enables applications to derive insights from social media, enterprise data, or other digital communications. The service uses linguistic analytics to infer personality and social characteristics, including Big Five, Needs, and Values, from text.

```swift
let service = PersonalityInsights(username: "yourusername", password: "yourpassword")

service!.getProfile("Some text here") { profile, error in

// code here
}
```
Expand All @@ -279,7 +284,7 @@ The IBM Watson Speech to Text service uses speech recognition capabilities to co

Create a SpeechToText service:

```swift
```swift
let stt = SpeechToText(authStrategy: strategy)
```

Expand All @@ -288,10 +293,10 @@ You can create an AVAudioRecorder with the necessary settings:
```swift

let filePath = NSURL(fileURLWithPath: "\(NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])/SpeechToTextRecording.wav")

let session = AVAudioSession.sharedInstance()
var settings = [String: AnyObject]()

settings[AVSampleRateKey] = NSNumber(float: 44100.0)
settings[AVNumberOfChannelsKey] = NSNumber(int: 1)
do {
Expand All @@ -306,18 +311,18 @@ To make a call for transcription, use:

```swift
let data = NSData(contentsOfURL: recorder.url)

if let data = data {

sttService.transcribe(data , format: .WAV, oncompletion: {

response, error in

// code here
}
}
```



The following links provide additional information about the IBM Speech to Text service:
Expand All @@ -340,10 +345,10 @@ service.setUsernameAndPassword(username: "yourname", password: "yourpass")

To call the service to synthesize text:

```swift
```swift
service.synthesize("Hello World", oncompletion: {
data, error in
data, error in

if let data = data {
// code here
}
Expand All @@ -366,14 +371,14 @@ The Watson TTS service contains support for many voices with different genders,
service.listVoices({
voices, error in
// code here

})
```

The following voices can be used:

Voice | Language | Gender
------------ | ----------- | ---------------
------------ | ----------- | ---------------
de-DE_BirgitVoice | German | Female
de-DE_DieterVoice | German | Male
en-GB_KateVoice | English (British) | Female
Expand All @@ -389,8 +394,8 @@ To use the voice, such as Kate's, specify the voice identifier in the synthesize

```swift
service.synthesize("Hello World", voice: "en-GB_KateVoice", "oncompletion: {
data, error in
data, error in
if let data = data {
// code here
}
Expand All @@ -407,7 +412,7 @@ The following links provide more information about the Text To Speech service:
IBM Watson Services are hosted in the Bluemix platform. Before you can use each service in the SDK, the service must first be created in Bluemix, bound to an Application, and you must have the credentials that Bluemix generates for that service. Alchemy services use a single API key, and all the other Watson services use a username and password credential. For the services that have username and password credentials, a web service is used to grant a temporary Watson token to the client that can be used for subsequent calls.
It is not advisable in a full production app to embed the username and passwords in your application, since the application could be decompiled to extract those credentials. Instead, these credentials should remain on a deployed server, and should handle fetching the Watson token on behalf of the mobile application. Since there could be many strategies one could take to authenticate with Bluemix, we abstract the mechanism with a collection of classes that use the protocol *AuthenticationStrategy*.
It is not advisable in a full production app to embed the username and passwords in your application, since the application could be decompiled to extract those credentials. Instead, these credentials should remain on a deployed server, and should handle fetching the Watson token on behalf of the mobile application. Since there could be many strategies one could take to authenticate with Bluemix, we abstract the mechanism with a collection of classes that use the protocol *AuthenticationStrategy*.
To quickly get started with the SDK, you can use a *BasicAuthenticationStrategy* when you create a service. You can specify the username and password, and it automatically handles fetching a temporary key from the token server. If the token expires, the strategy will fetch a new one.
Expand Down Expand Up @@ -456,5 +461,3 @@ See [CONTRIBUTING](CONTRIBUTING.md) on how to help out.
[sentiment_analysis]: http://www.alchemyapi.com/products/alchemylanguage/sentiment-analysis
[alchemy_vision]: http://www.alchemyapi.com/products/alchemyvision
[alchemy_data_news]: http://www.alchemyapi.com/products/alchemydata-news
8 changes: 4 additions & 4 deletions WatsonDeveloperCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
7A0F97101C232B96004C01C0 /* WatsonError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F967C1C232B96004C01C0 /* WatsonError.swift */; };
7A0F97111C232B96004C01C0 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F967D1C232B96004C01C0 /* Validation.swift */; };
7A0F97121C232B96004C01C0 /* WatsonCoreConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F967E1C232B96004C01C0 /* WatsonCoreConstants.swift */; };
7A0F97131C232B96004C01C0 /* WatsonManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F967F1C232B96004C01C0 /* WatsonManager.swift */; };
7A0F97131C232B96004C01C0 /* WatsonGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F967F1C232B96004C01C0 /* WatsonGateway.swift */; };
7A0F97141C232B96004C01C0 /* WatsonRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F96801C232B96004C01C0 /* WatsonRequest.swift */; };
7A0F97151C232B96004C01C0 /* WatsonService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F96811C232B96004C01C0 /* WatsonService.swift */; };
7A0F97161C232B9C004C01C0 /* AlchemyLanguageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A0F95F01C232B96004C01C0 /* AlchemyLanguageTests.swift */; };
Expand Down Expand Up @@ -344,7 +344,7 @@
7A0F967C1C232B96004C01C0 /* WatsonError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonError.swift; sourceTree = "<group>"; };
7A0F967D1C232B96004C01C0 /* Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validation.swift; sourceTree = "<group>"; };
7A0F967E1C232B96004C01C0 /* WatsonCoreConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonCoreConstants.swift; sourceTree = "<group>"; };
7A0F967F1C232B96004C01C0 /* WatsonManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonManager.swift; sourceTree = "<group>"; };
7A0F967F1C232B96004C01C0 /* WatsonGateway.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonGateway.swift; sourceTree = "<group>"; };
7A0F96801C232B96004C01C0 /* WatsonRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonRequest.swift; sourceTree = "<group>"; };
7A0F96811C232B96004C01C0 /* WatsonService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WatsonService.swift; sourceTree = "<group>"; };
7A0F97311C232D02004C01C0 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -789,7 +789,7 @@
7A0F96751C232B96004C01C0 /* Utilities */,
7A0F967D1C232B96004C01C0 /* Validation.swift */,
7A0F967E1C232B96004C01C0 /* WatsonCoreConstants.swift */,
7A0F967F1C232B96004C01C0 /* WatsonManager.swift */,
7A0F967F1C232B96004C01C0 /* WatsonGateway.swift */,
7A0F96801C232B96004C01C0 /* WatsonRequest.swift */,
7A0F96811C232B96004C01C0 /* WatsonService.swift */,
);
Expand Down Expand Up @@ -1043,7 +1043,7 @@
7A0F97041C232B96004C01C0 /* NSError.swift in Sources */,
7A0F96DF1C232B96004C01C0 /* SpeechToTextResult.swift in Sources */,
7A0F96FF1C232B96004C01C0 /* APIKeyAuthenticationStrategy.swift in Sources */,
7A0F97131C232B96004C01C0 /* WatsonManager.swift in Sources */,
7A0F97131C232B96004C01C0 /* WatsonGateway.swift in Sources */,
7A0F96951C232B96004C01C0 /* Keywords.swift in Sources */,
7A0F96DD1C232B96004C01C0 /* SpeechToTextDelegate.swift in Sources */,
7A0F96A51C232B96004C01C0 /* AlchemyCombineDictionaryUtil.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Loading

0 comments on commit a744ca3

Please sign in to comment.