{"id":13588343,"url":"https://github.com/mapbox/mapbox-speech-swift","last_synced_at":"2025-10-20T12:59:41.572Z","repository":{"id":37622738,"uuid":"103685499","full_name":"mapbox/mapbox-speech-swift","owner":"mapbox","description":"Natural-sounding text-to-speech in Swift or Objective-C on iOS, macOS, tvOS, and watchOS","archived":false,"fork":false,"pushed_at":"2022-12-08T12:22:53.000Z","size":470,"stargazers_count":46,"open_issues_count":7,"forks_count":17,"subscribers_count":99,"default_branch":"main","last_synced_at":"2025-10-20T12:59:24.652Z","etag":null,"topics":["amazon-polly","ios","macos","speech-synthesis","speech-synthesizer","swift","text-to-speech","tts","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-15T17:47:40.000Z","updated_at":"2025-06-07T16:57:08.000Z","dependencies_parsed_at":"2022-08-30T00:10:57.999Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/mapbox-speech-swift","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/mapbox-speech-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-speech-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-speech-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-speech-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-speech-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/mapbox-speech-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmapbox-speech-swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280094904,"owners_count":26271003,"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","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["amazon-polly","ios","macos","speech-synthesis","speech-synthesizer","swift","text-to-speech","tts","tvos","watchos"],"created_at":"2024-08-01T15:06:39.103Z","updated_at":"2025-10-20T12:59:41.555Z","avatar_url":"https://github.com/mapbox.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# Mapbox Speech\n\n[![CircleCI](https://circleci.com/gh/mapbox/mapbox-speech-swift.svg?style=svg)](https://circleci.com/gh/mapbox/mapbox-speech-swift)\n[![codecov](https://codecov.io/gh/mapbox/mapbox-speech-swift/branch/main/graph/badge.svg?token=uKxKAJ2DQH)](https://codecov.io/gh/mapbox/mapbox-speech-swift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods](https://img.shields.io/cocoapods/v/MapboxSpeech.svg)](https://cocoapods.org/pods/MapboxSpeech/)\n[![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager/)\n\nMapbox Speech connects your iOS, macOS, tvOS, or watchOS application to the Mapbox Voice API. Take turn instructions from the [Mapbox Directions API](https://www.mapbox.com/api-documentation/#directions) and read them aloud naturally in multiple languages. This library is specifically designed to work with [mapbox-directions-swift](https://github.com/mapbox/mapbox-directions-swift/) as part of the [Mapbox Navigation SDK for iOS](https://github.com/mapbox/mapbox-navigation-ios/).\n\nThis library is compatible with applications written in Swift. Version 2.0 was the last version of this library to support applications written in Objective-C or AppleScript.\n\n## Getting started\n\nSpecify the following dependency in your [Carthage](https://github.com/Carthage/Carthage) Cartfile:\n\n```cartfile\ngithub \"mapbox/mapbox-speech-swift\" ~\u003e 2.1\n```\n\nOr in your [CocoaPods](http://cocoapods.org/) Podfile:\n\n```podspec\npod 'MapboxSpeech', '~\u003e 2.1'\n```\n\nOr in your [Swift Package Manager](https://swift.org/package-manager/) Package.swift:\n\n```swift\n.package(url: \"https://github.com/mapbox/mapbox-speech-swift.git\", from: \"2.1.1\")\n```\n\nThen `import MapboxSpeech` or `@import MapboxSpeech;`.\n\n## Usage\n\nYou’ll need a [Mapbox access token](https://www.mapbox.com/developers/api/#access-tokens) in order to use the API. If you’re already using the [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) or [macOS SDK](https://mapbox.github.io/mapbox-gl-native/macos/), Mapbox Speech automatically recognizes your access token, as long as you’ve placed it in the `MBXAccessToken` key of your application’s Info.plist file.\n\n### Basics\n\nThe main speech synthesis class is `SpeechSynthesizer`. Create a speech synthesizer object using your access token:\n\n```swift\nimport MapboxSpeech\n\nlet speechSynthesizer = SpeechSynthesizer(accessToken: \"\u003c#your access token#\u003e\")\n```\n\nAlternatively, you can place your access token in the `MBXAccessToken` key of your application’s Info.plist file, then use the shared speech synthesizer object:\n\n```swift\n// main.swift\nlet speechSynthesizer = SpeechSynthesizer.shared\n```\n\nWith the directions object in hand, construct a SpeechOptions or MBSpeechOptions object and pass it into the `SpeechSynthesizer.audioData(with:completionHandler:)` method.\n\n```swift\n// main.swift\n\nlet options = SpeechOptions(text: \"hello, my name is Bobby\")\nspeechSynthesizer.audioData(with: options) { (data: Data?, error: NSError?) in\n    guard error == nil else {\n        print(\"Error calculating directions: \\(error!)\")\n        return\n    }\n    \n    // Do something with the audio!\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmapbox-speech-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fmapbox-speech-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmapbox-speech-swift/lists"}