{"id":13801246,"url":"https://github.com/watson-developer-cloud/swift-sdk","last_synced_at":"2025-05-15T11:08:24.255Z","repository":{"id":3034684,"uuid":"42934262","full_name":"watson-developer-cloud/swift-sdk","owner":"watson-developer-cloud","description":":iphone: The Watson Swift SDK enables developers to quickly add Watson Cognitive Computing services to their Swift applications.","archived":false,"fork":false,"pushed_at":"2025-04-22T19:18:35.000Z","size":158413,"stargazers_count":879,"open_issues_count":4,"forks_count":221,"subscribers_count":65,"default_branch":"master","last_synced_at":"2025-04-22T20:29:43.093Z","etag":null,"topics":["hacktoberfest","ibm-watson-services","ibm-watson-speech","swift-4"],"latest_commit_sha":null,"homepage":"https://watson-developer-cloud.github.io/swift-sdk/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/watson-developer-cloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-22T13:07:37.000Z","updated_at":"2025-04-22T19:18:35.000Z","dependencies_parsed_at":"2025-01-16T10:15:22.618Z","dependency_job_id":null,"html_url":"https://github.com/watson-developer-cloud/swift-sdk","commit_stats":{"total_commits":3228,"total_committers":54,"mean_commits":59.77777777777778,"dds":0.7837670384138786,"last_synced_commit":"8359f8d2000c53d11d0757d5413f411ac34fac4e"},"previous_names":[],"tags_count":102,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Fswift-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Fswift-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Fswift-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson-developer-cloud%2Fswift-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/watson-developer-cloud","download_url":"https://codeload.github.com/watson-developer-cloud/swift-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328385,"owners_count":22052632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","ibm-watson-services","ibm-watson-speech","swift-4"],"created_at":"2024-08-04T00:01:20.882Z","updated_at":"2025-05-15T11:08:24.248Z","avatar_url":"https://github.com/watson-developer-cloud.png","language":"Swift","funding_links":[],"categories":["Swift","Data \u0026 AI"],"sub_categories":[],"readme":"# Watson Developer Cloud Swift SDK\n\n[![Build and Test](https://github.com/watson-developer-cloud/swift-sdk/actions/workflows/build-test.yml/badge.svg)](https://github.com/watson-developer-cloud/swift-sdk/actions/workflows/build-test.yml)\n[![Deploy and Publish](https://github.com/watson-developer-cloud/swift-sdk/actions/workflows/deploy.yml/badge.svg)](https://github.com/watson-developer-cloud/swift-sdk/actions/workflows/deploy.yml)\n![](https://img.shields.io/badge/platform-iOS,%20Linux-blue.svg?style=flat)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Documentation](https://img.shields.io/badge/Documentation-API-blue.svg)](http://watson-developer-cloud.github.io/swift-sdk)\n[![CLA assistant](https://cla-assistant.io/readme/badge/watson-developer-cloud/swift-sdk)](https://cla-assistant.io/watson-developer-cloud/swift-sdk)\n[![wdc-community.slack.com](https://wdc-slack-inviter.mybluemix.net/badge.svg)](http://wdc-slack-inviter.mybluemix.net/)\n\n## Deprecation Notice\nThis repo is being deprecated. While this repo will no longer see active support from the IBM team, contributions by the community via PRs are still welcomed and will be reviewed. Keep in mind, updates will no longer be published to spm, Carthage, or CocoaPods and changes made after this update will need to be built independently.\n\n## Overview\n\nThe Watson Developer Cloud Swift SDK makes it easy for mobile developers to build Watson-powered applications. With the Swift SDK you can leverage the power of Watson's advanced artificial intelligence, machine learning, and deep learning techniques to understand unstructured data and engage with mobile users in new ways.\n\nThere are many resources to help you build your first cognitive application with the Swift SDK:\n\n- Review a [Featured Project](#featured-projects)\n- Browse the [Documentation](https://watson-developer-cloud.github.io/swift-sdk/)\n\n### Services\n\nThis SDK provides classes and methods to access the following Watson services.\n\n- [Assistant](https://www.ibm.com/cloud/watson-assistant/)\n- [Discovery](https://www.ibm.com/cloud/watson-discovery)\n- [Language Translator V3](https://www.ibm.com/watson/services/language-translator)\n- [Natural Language Understanding](https://www.ibm.com/cloud/watson-natural-language-understanding)\n- [Speech to Text](https://www.ibm.com/cloud/watson-speech-to-text)\n- [Text to Speech](https://www.ibm.com/cloud/watson-text-to-speech)\n\n## Announcements\n\n### Tone Analyzer Deprecation\n\nAs of this major release, 5.0.0, the Tone Analyzer api has been removed in preparation for deprecation. If you wish to continue using this sdk to make calls to Tone Analyzer until its final deprecation, you will have to use a previous version.\n\nOn 24 February 2022, IBM announced the deprecation of the Tone Analyzer service. The service will no longer be available as of 24 February 2023. As of 24 February 2022, you will not be able to create new instances. Existing instances will be supported until 24 February 2023.\n\nAs an alternative, we encourage you to consider migrating to the Natural Language Understanding service on IBM Cloud. With Natural Language Understanding, tone analysis is done by using a pre-built classifications model, which provides an easy way to detect language tones in written text. For more information, see [Migrating from Watson Tone Analyzer Customer Engagement endpoint to Natural Language Understanding](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-tone_analytics).\n\n### Natural Language Classifier Deprecation\n\nAs of this major release, 5.0.0, the NLC api has been removed in preparation for deprecation. If you wish to continue using this sdk to make calls to NLC until its final deprecation, you will have to use a previous version.\n\nOn 9 August 2021, IBM announced the deprecation of the Natural Language Classifier service. The service will no longer be available from 8 August 2022. As of 9 September 2021, you will not be able to create new instances. Existing instances will be supported until 8 August 2022. Any instance that still exists on that date will be deleted.\n\nAs an alternative, we encourage you to consider migrating to the Natural Language Understanding service on IBM Cloud that uses deep learning to extract data and insights from text such as keywords, categories, sentiment, emotion, and syntax, along with advanced multi-label text classification capabilities, to provide even richer insights for your business or industry. For more information, see [Migrating to Natural Language Understanding](https://cloud.ibm.com/docs/natural-language-classifier?topic=natural-language-classifier-migrating).\n\n## Before you begin\n\n- You need an [IBM Cloud][ibm-cloud-onboarding] account.\n\n## Requirements\n\n- Xcode 10.2+\n- Swift 5.0+\n- iOS 10.0+\n\n## Installation\n\nThe IBM Watson Swift SDK can be installed with [Swift Package Manager](https://swift.org/package-manager/), [Cocoapods](http://cocoapods.org/), or [Carthage](https://github.com/Carthage/Carthage).\n\n### Swift Package Manager\n\nNew in version 4.0.2, the Watson Developer Cloud Swift SDK now supports all services through Swift Package Manager.\n\nOn the XCode menu bar at the top of your screen click `File -\u003e Swift Packages -\u003e Add Package Dependencies`, follow the prompts by pasting the github url `https://github.com/watson-developer-cloud/swift-sdk` and using the most recent major version if appropriate. Make sure to only click on the services you plan on using otherwise you may face long build times\n\nTo import a service into your project:\n\n```swift\nimport AssistantV2\nimport DiscoveryV2\n.\n.\n.\n```\n\n**(Speech To Text and Text To Speech only)**\nThe use of the `libogg` and `opus` libraries by these services requires extra steps to be taken BEFORE the package is installed.\n\n1. You will need [Homebrew](http://brew.sh/) installed\n2. Install `libogg` and `opus`\n   ```bash\n   $ brew install libogg opus\n   ```\n3. Packaged dynamic libraries must be removed according to current library versions.\n\n   libogg version as of writing: 1.3.4.\n\n   opus version as of writing: 1.3.1\n\n   ```bash\n   $ rm -f /usr/local/Cellar/libogg/1.3.4/lib/*.dylib\n   ```\n\n   ```bash\n   $ rm -f /usr/local/Cellar/opus/1.3.1/lib/*.dylib\n   ```\n\n4. The static libraries installed must be replaced with libraries compiled for multiple architectures. These libraries can be downloaded from this github repo for libogg [here](https://github.com/watson-developer-cloud/swift-sdk/blob/master/Sources/SupportingFiles/Dependencies/Libraries/libogg.a) and opus [here](https://github.com/watson-developer-cloud/swift-sdk/blob/master/Sources/SupportingFiles/Dependencies/Libraries/libopus.a)\n\n5. Replace the currently installed `libogg` and `libopus` libraries\n\n   ```bash\n   rm -f /usr/local/Cellar/libogg/1.3.4/lib/libogg.a \u0026\u0026 cp ~/Downloads/libogg.a /usr/local/Cellar/libogg/1.3.4/lib\n   ```\n\n   ```bash\n   rm -f /usr/local/Cellar/opus/1.3.1/lib/libopus.a \u0026\u0026 cp ~/Downloads/libopus.a /usr/local/Cellar/opus/1.3.1/lib\n   ```\n\n6. If you run into any build errors or imported the package before performing the above steps, the project may need to be reindexed. Remove the `WatsonDeveloperCloud` package from your XCode project file under `Swift Packages`; then, from the XCode menu bar on the top of the screen click `Product -\u003e Clean Build Folder` and lastly reinstall the package.\n\n7. You're ready to go!\n\n### Cocoapods\n\nYou can install Cocoapods with [RubyGems](https://rubygems.org/):\n\n```bash\n$ sudo gem install cocoapods\n```\n\nIf your project does not yet have a Podfile, use the `pod init` command in the root directory of your project. To install the Swift SDK using Cocoapods, add the services you will be using to your Podfile as demonstrated below (substituting `MyApp` with the name of your app). The example below shows all of the currently available services; your Podfile should only include the services that your app will use.\n\n```ruby\nuse_frameworks!\n\ntarget 'MyApp' do\n    pod 'IBMWatsonAssistantV1', '~\u003e 5.0.0'\n    pod 'IBMWatsonAssistantV2', '~\u003e 5.0.0'\n    pod 'IBMWatsonDiscoveryV1', '~\u003e 5.0.0'\n    pod 'IBMWatsonLanguageTranslatorV3', '~\u003e 5.0.0'\n    pod 'IBMWatsonNaturalLanguageUnderstandingV1', '~\u003e 5.0.0'\n    pod 'IBMWatsonSpeechToTextV1', '~\u003e 5.0.0'\n    pod 'IBMWatsonTextToSpeechV1', '~\u003e 5.0.0'\nend\n```\n\nRun the `pod install` command, and open the generated `.xcworkspace` file. To update to newer releases, use `pod update`.\n\nWhen importing the frameworks in source files, exclude the `IBMWatson` prefix and the version suffix. For example, after installing `IBMWatsonAssistantV1`, import it in your source files as `import Assistant`.\n\nFor more information on using Cocoapods, refer to the [Cocoapods Guides](https://guides.cocoapods.org/using/index.html).\n\n### Carthage\n\n**NOTE**: The release of Apple's new M1 chip has caused issues in Carthage for XCode versions 11+. For the foreseeable future, we are unable to support XCode 11 through Carthage. We would recommend installing through Swift Package Manager (preferable) or upgrading to XCode 12 (where there is a workaround).\n\n**NOTE**: Our frameworks cannot currently be run on the new Apple Silicon Macs through Carthage. Again, we recommend the use of Swift Package Manager instead.\n\nYou can install Carthage with [Homebrew](http://brew.sh/):\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nIf your project does not have a Cartfile yet, use the `touch Cartfile` command in the root directory of your project. To install the IBM Watson Swift SDK using Carthage, add the following to your Cartfile.\n\n```\ngithub \"watson-developer-cloud/swift-sdk\" ~\u003e 5.0.0\n```\n\nFollow the remaining Carthage installation instructions for the XCode 12 workaround [here](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md#how-to-make-it-work). Then run the following command to build the dependencies and frameworks:\n\n```bash\n$ carthage.sh bootstrap --platform iOS\n```\n\nNote that the above command will download and build all of the services in the IBM Watson Swift SDK and does take awhile.\n\nFollow the next steps to link the frameworks to your XCode project:\n\n1.  Make sure to drag-and-drop the built frameworks (only for the services your app requires) into your app target under `General -\u003e Frameworks, Libraries, and Embedded Content` (XCode \u003c= 10.x: `General -\u003e Linked Frameworks and Libraries` ) and import them in the source files that require them. You will find the .framework files under `./Carthage/Build/iOS` from your source directory.\n\n2.  The following frameworks need to be added to your app:\n    `IBMSwiftSDKCore.framework`\n\n    Whichever services your app will be using (`AssistantV1.framework`, `DiscoveryV1.framework`, etc.)\n\n    (**Speech to Text only**) `Starscream.framework`. Be sure to add this framework to your `input.xcfilelist` and `output.xcfilelist` which will be detailed below\n\n3.  XCode 12 only: Under the `Embed` column make sure each framework is set to `Do Not Embed`\n\n4.  On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:\n\n    ```\n    /usr/local/bin/carthage copy-frameworks\n    ```\n\n5.  Create a file named `input.xcfilelist` and a file named `output.xcfilelist`\n\n6.  Add the paths to the frameworks you want to use to your `input.xcfilelist`. For example:\n\n    ```\n    $(SRCROOT)/Carthage/Build/iOS/IBMSwiftSDKCore.framework\n    $(SRCROOT)/Carthage/Build/iOS/DiscoveryV1.framework\n    ```\n\n7.  Add the paths to the copied frameworks to the `output.xcfilelist`. For example:\n\n    ```\n    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/IBMSwiftSDKCore.framework\n    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/DiscoveryV1.framework\n    ```\n\n    With output files specified alongside the input files, XCode only needs to run the script when the input files have changed or the output files are missing. This means dirty builds will be faster when you haven't rebuilt frameworks with Carthage.\n\n8.  Add the path to `input.xcfilelist` to the \"Input File Lists\" section of the Carthage run script phase. This will usually be `$(SRCROOT)/input.xcfilelist`\n9.  Add the path to `output.xcfilelist` to the \"Output File Lists\" section of the Carthage run script phase. This will usually be `$(SRCROOT)/output.xcfilelist`\n\nIf your app fails to build because it is built with a different version of Swift than the downloaded SDK, then re-run the `carthage.sh bootstrap` command with the `--no-use-binaries` flag added.\n\n## Authentication\n\nIn order to use an IBM Watson service in a Swift application, you will need to authenticate. The following describes the typical path you need to take to do so.\n\n### Step 1: Getting credentials\n\nCredentials to use an IBM Watson service are obtained via IBM Cloud. You will need an active account and a service instance for the service that you wish to use prior to authenticating in your Swift app.\n\nYou can access the service credentials for your instance by taking the following steps:\n\n1. Go to the IBM Cloud [Dashboard](https://cloud.ibm.com/) page.\n1. Either click an existing Watson service instance in your [resource list](https://cloud.ibm.com/resources) or click [**Create resource \u003e AI**](https://cloud.ibm.com/catalog?category=ai) and create a service instance.\n1. Click on the **Manage** item in the left nav bar of your service instance.\n\nOn this page, you will see your credentials to use in the SDK to access your service instance.\n\n### Step 2: Authenticating in Code\n\nThe Watson Swift SDK manages authentication using an `Authenticator` class. There are multiple types of Authenticators depending on your preferred method.\n\n#### WatsonIAMAuthenticator (most common)\n\nThe `WatsonIAMAuthenticator` allows you to authenticate with using an IAM API key. This is the most common form of authentication within IBM Cloud. The `WatsonIAMAuthenticator` requires an `apikey` string in its initialization method.\n\nExample:\n\n```swift\nlet authenticator = WatsonIAMAuthenticator(apiKey: \"{apikey}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\n...\n```\n\n#### WatsonBearerTokenAuthenticator\n\nYou may want to provide a bearer token to authenticate with a service. On IBM Cloud this would be done using the IAM service to generate a token based on your service credentials. On Cloud Pak for Data this would be available within an individual service instance.\n\nTo authenticate in a Swift app using an access token, you can use the `WatsonBearerTokenAuthenticator`, and provide the token.\n\nExample:\n\n```swift\nlet authenticator = WatsonBearerTokenAuthenticator(bearerToken: \"{token}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\n...\n```\n\n#### WatsonCloudPakForDataAuthenticator\n\nIf you are using IBM Cloud Pak for Data (CP4D) instead of the public IBM Cloud, you can use the `WatsonCloudPakForDataAuthenticator` to authenticate with your CP4D cluster. As opposed to `WatsonBearerTokenAuthenticator` which accepts a bearer token, the `WatsonCloudPakForDataAuthenticator` accepts the username and password for the CP4D cluster itself.\n\nExample:\n\n```swift\nlet authenticator = WatsonCloudPakForDataAuthenticator(username: \"{username}\", password: \"{password}\", url: \"https://{cpd_cluster_host}{:port}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\n...\n```\n\n#### Detecting authentication from environment variables\n\nThe SDK can extract service credentails from the environment, e.g. the VCAP_SERVICES environment variable, or a local credentials file.\n\nTo use credentials stored in a local file, go to the Manage tab of your service instance on IBM Cloud, and click on the button to download the credentials. The file will be called `ibm-credentials.env`. Add this file to a location that is accessible from your project. For iOS apps, make sure to add it to the application target.\n\n```swift\nlet assistant = Assistant(version: \"your-version\") // by calling the init method without an authenticator, the SDK will search for environment variables\n\n...\n```\n\nIf your project is using multiple Watson services, you can merge the contents of the `ibm-credentials.env` files into a single file. Lines in the file can be added, deleted, or reordered, but the content of each line must not be changed.\n\n#### Further info on authentication methods\n\nTo see further details and additional, but less common, forms of authentication, see the [IBM Swift SDK Core code for Authenticator.](https://github.com/IBM/swift-sdk-core/tree/master/Sources/IBMSwiftSDKCore/Authentication)\n\n## Custom Service URLs\n\nYou can set a custom service URL by modifying the `serviceURL` property. A custom service URL may be required when running an instance in a particular region or connecting through a proxy.\n\nFor example, here is how to connect to a Watson Assistant instance that is hosted in Germany:\n\n```swift\nlet authenticator = WatsonIAMAuthenticator(apiKey: \"{apikey}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\nassistant.serviceURL = \"https://api.eu-de.assistant.watson.cloud.ibm.com\"\n```\n\n## Disable SSL certificate verification\n\nFor Watson Cloud Pak for Data (CP4D), you may need to disable SSL hostname verification if you are using self-signed certificates. Each service class has a `disableSSLVerification` method which allows you to do so.\n\n```swift\nlet authenticator = WatsonCloudPakForDataAuthenticator(username: \"{username}\", password: \"{password}\", url: \"https://{cpd_cluster_host}{:port}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\nassistant.disableSSLVerification()\n```\n\nNote: `disableSSLVerification()` is currently not supported on Linux.\n\n## Obtaining Transaction IDs\n\nWhen debugging an issue with IBM support, you may be asked to provide a `transaction ID` to help IBM identify an API call that needs to be debugged.\n\nEvery SDK call returns a response with a transaction ID in the `X-Global-Transaction-Id` header. Together the service instance region, this ID helps support teams troubleshoot issues from relevant logs.\n\nYou can access the header following the pattern below:\n\n```swift\nimport AssistantV1\n\nlet authenticator = WatsonIAMAuthenticator(apiKey: \"{apikey}\")\nlet assistant = Assistant(version: \"2020-04-01\", authenticator: authenticator)\nassistant.serviceURL = \"{url}\"\n\nlet input = MessageInput(text: \"Hello\")\n\n// let's say this request isn't working and you need the transaction ID\nassistant.message(workspaceID: \"{workspace_id}\", input: input) {\n  response, error in\n\n  print(response?.headers[\"X-Global-Transaction-Id\"]!)\n\n  ...\n}\n```\n\nHowever, the transaction ID isn't available when the API doesn't return a response for some reason. In that case, you can set your own transaction ID in the request. For example, replace `\u003cmy-unique-transaction-id\u003e` in the following example with a unique transaction ID.\n\n```swift\nlet authenticator = WatsonIAMAuthenticator(apiKey: \"{apikey}\")\nlet assistant = Assistant(version: \"2020-04-01\", authenticator: authenticator)\nassistant.serviceURL = \"{url}\"\n\nlet input = MessageInput(text: \"Hello\")\n\nassistant.message(workspaceID: \"{workspace_id}\", input: input, headers: [\"X-Global-Transaction-Id\": \"\u003cmy-unique-transaction-id\u003e\"]) {\n  response, error in\n\n  print(response?.headers[\"X-Global-Transaction-Id\"]!)\n\n  ...\n}\n```\n\n## Custom Headers\n\nThere are different headers that can be sent to the Watson services. For example, Watson services log requests and their results for the purpose of improving the services, but you can include the `X-Watson-Learning-Opt-Out` header to opt out of this.\n\nWe have exposed a `defaultHeaders` public property in each class to allow users to easily customize their headers:\n\n```swift\nlet authenticator = WatsonIAMAuthenticator(apiKey: \"{apikey}\")\nlet assistant = Assistant(version: \"{version}\", authenticator: authenticator)\n\nassistant.defaultHeaders = [\"X-Watson-Learning-Opt-Out\": \"true\"]\n```\n\nEach service method also accepts an optional `headers` parameter which is a dictionary of request headers to be sent with the request.\n\n## Questions\n\nIf you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+swift).\n\n## Featured Projects\n\nWe love to highlight cool open-source projects that use this SDK! If you'd like to get your project added to the list, feel free to make an issue linking us to it.\n\n- [Simple Chat (Swift)](https://github.com/watson-developer-cloud/simple-chat-swift)\n- [Speech to Text](https://github.com/watson-developer-cloud/speech-to-text-swift)\n- [Text to Speech](https://github.com/watson-developer-cloud/text-to-speech-swift)\n\n## Synchronous Execution\n\nBy default, the SDK executes all networking operations asynchronously. If your application requires synchronous execution, you can use a `DispatchGroup`. For example:\n\n```swift\nlet dispatchGroup = DispatchGroup()\ndispatchGroup.enter()\nassistant.message(workspaceID: workspaceID) { response, error in\n\tif let error = error {\n        print(error)\n    }\n    if let message = response?.result else {\n        print(message.output.text)\n    }\n    dispatchGroup.leave()\n}\ndispatchGroup.wait(timeout: .distantFuture)\n```\n\n## Handling PNG and CgBI Files in XCode\n\nWhen working with iOS projects, you may need to add PNG images to your XCode resource bundle. By default, XCode converts PNG files to Apple's [CgBI file format](http://iphonedevwiki.net/index.php/CgBI_file_format) as an optimization step.\n\n### How to bypass CgBI Encoding for Resource Files\n\nIn order to bypass CgBI encoding and keep the PNG files in a format that will operate well with Watson services, select the PNG file in XCode, and modify the `Type` attribute to `Data` in the File Inspector.\n\nEx:  \n![File inspector example](https://raw.githubusercontent.com/watson-developer-cloud/swift-sdk/master/docs/images/png-file-inspector.png)\n\n### Future plans for handling CgBI\n\nIn the future, we will explore our options to handle conversion between CgBI and PNG within the Swift SDK, but this is currently not available.\n\n## Objective-C Compatibility\n\nPlease see [this tutorial](https://watson-developer-cloud.github.io/swift-sdk/docs/objective-c) for more information about consuming the Watson Developer Cloud Swift SDK in an Objective-C application.\n\n## Linux Compatibility\n\nTo use the Watson SDK in your Linux project, please follow the [Swift Package Manager instructions.](#swift-package-manager). Note that Speech to Text and Text to Speech are not supported because they rely on frameworks that are unavailable on Linux.\n\n## Contributing\n\nWe would love any and all help! If you would like to contribute, please read our [CONTRIBUTING](https://github.com/watson-developer-cloud/swift-sdk/blob/master/.github/CONTRIBUTING.md) documentation with information on getting started.\n\n## License\n\nThis library is licensed under Apache 2.0. Full license text is\navailable in [LICENSE](https://github.com/watson-developer-cloud/swift-sdk/blob/master/LICENSE).\n\nThis SDK is intended for use with an Apple iOS product and intended to be used in conjunction with officially licensed Apple development tools.\n\n[ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson\u0026cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Swift\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson-developer-cloud%2Fswift-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatson-developer-cloud%2Fswift-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson-developer-cloud%2Fswift-sdk/lists"}