PSPDFSpeechController


@interface PSPDFSpeechController : NSObject

Controls text-to-speech features. - note: This class can only be used from the main thread.

  • Speak string. Setting language to nil will use the default language set here.

    Declaration

    Objective-C

    - (void)speakText:(nonnull NSString *)speechString
              options:(nullable NSDictionary<NSString *, id> *)options
             delegate:(nullable id<AVSpeechSynthesizerDelegate>)delegate;

    Swift

    @IBAction func speakText(_ speechString: String, options: [String : Any]? = nil, delegate: NSSpeechSynthesizerDelegate?)
  • If this delegate is set, stop current text.

    Declaration

    Objective-C

    - (BOOL)stopSpeakingForDelegate:
        (nullable id<AVSpeechSynthesizerDelegate>)delegate;

    Swift

    func stopSpeaking(for delegate: NSSpeechSynthesizerDelegate?) -> Bool
  • The internally used speech synthesizer.

    Declaration

    Objective-C

    @property (readonly, nonatomic) AVSpeechSynthesizer *_Nonnull speechSynthesizer;

    Swift

    var speechSynthesizer: NSSpeechSynthesizer { get }
  • Speech language. Defaults to PSPDFSpeechSynthesizerAutoDetectLanguage.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) NSString *_Nonnull selectedLanguage;

    Swift

    var selectedLanguage: String { get set }
  • Available language codes, use for selectedLanguage.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<NSString *> *_Nonnull languageCodes;

    Swift

    var languageCodes: [String] { get }
  • Speech rate. Defaults to AVSpeechUtteranceDefaultSpeechRate.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) float speakRate;

    Swift

    var speakRate: Float { get set }
  • Speech pitch. Defaults to 1.0f.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) float pitchMultiplier;

    Swift

    var pitchMultiplier: Float { get set }