SpeechManager

2.0.2

SpeechManager is a simple utility for adding text-to-speech to your app quickly and easily.
Appracatappra/SpeechManager

What's New

2.0.2

2024-06-12T18:28:47Z

PrivacyInfo Updates.

SpeechManager

SpeechManager is a simple utility for adding text-to-speech to your app quickly and easily.

Support

If you find SpeechManager useful and would like to help support its continued development and maintenance, please consider making a small donation, especially if you are using it in a commercial product:

Buy Me A Coffee

It's through the support of contributors like yourself, I can continue to build, release and maintain high-quality, well documented Swift Packages like SpeechManager for free.

Installation

Swift Package Manager (Xcode 11 and above)

  1. In Xcode, select the File > Add Package Dependency… menu item.
  2. Paste https://github.com/Appracatappra/SpeechManager.git in the dialog box.
  3. Follow the Xcode's instruction to complete the installation.

Why not CocoaPods, or Carthage, or blank?

Supporting multiple dependency managers makes maintaining a library exponentially more complicated and time consuming.

Since, the Swift Package Manager is integrated with Xcode 11 (and greater), it's the easiest choice to support going further.

Overview

SpeechManager provides a simply way to have your App read text out loud.

User Preference Options

SpeechManager has a build in User Preference property to control speaking:

/// If `true` the app will read text aloud, else it will not.
@AppStorage("speakText") public var speakText: Bool = true

You can provide a UI in your App to allow the end user to control their speech preferences.

How To Use

SpeechManager provides several functions for controlling speech in your app. The most commonly user are:

  • sayPhrase - public func sayPhrase(_ text:String) Reads the given text aloud.
  • sayPhrase - public func sayPhrase(_ text:String, inVoice:VoiceLanguage) Reads the given text aloud in the given language.
  • stopSpeaking - public func stopSpeaking() Stops the current text from being read aloud.

Languages

The VoiceLanguage enumeration defines the language specific voices that you can use to say a phrase:

public enum VoiceLanguage: String {
    case arabicSaudiArabia = "ar-SA"
    case czechCzechRepublic = "cs-CZ"
    case danishDenmark = "da-DK"
    case germanGermany = "de-DE"
    case greekModernGreece = "el-GR"
    case englishAustralia = "en-AU"
    case englishUnitedKingdom = "en-GB"
    case englishIreland = "en-IE"
    case englishIndia = "en-IN"
    case englishUnitedStates = "en-US"
    case englishSouthAfrica = "en-ZA"
    case spanishMexico = "es-MX"
    case spanishSpain = "es-ES"
    case finnishFinland = "fi-FI"
    case frenchCanada = "fr-CA"
    case frenchFrance = "fr-FR"
    case hebrewIsrael = "he-IL"
    case hindiIndia = "hi-IN"
    case indonesianIndonesia = "id-ID"
    case italianItaly = "it-IT"
    case japaneseJapan = "ja-JP"
    case koreanKorea = "ko-KR"
    case dutchBelgium = "nl-BE"
    case dutchNetherlands = "nl-NL"
    case norwegianNorway = "no-NO"
    case polishPoland = "pl-PL"
    case portugueseBrazil = "pt-BR"
    case portuguesePortugal = "pt-PT"
    case romanianRomania = "ro-RO"
    case russianRussianFederation = "ru-RU"
    case slovakSlovakia = "sk-SK"
    case swedishSweden = "sv-SE"
    case thaiThailand = "th-TH"
    case turkishTurkey = "tr-TR"
    case chineseShina = "zh-CN"
    case chineseHongKong = "zh-HK"
    case chineseTaiwan = "zh-TW"
}

Not all voices are available on all platforms.

Documentation

The Package includes full DocC Documentation for all features.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Sun Oct 27 2024 15:19:18 GMT-0900 (Hawaii-Aleutian Daylight Time)