All Projects → alexruperez → ARSpeechActivity

alexruperez / ARSpeechActivity

Licence: MIT license
ARSpeechActivity is a UIActivity subclass that uses AVSpeechUtterance to read aloud the shared NSString

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

ARSpeechActivity

Twitter GitHub Issues Version License Platform Analytics

ARSpeechActivity is a UIActivity subclass that provides a "Read" action to a UIActivityViewController.

ARSpeechActivity screenshot

Requirements

  • As UIActivity is iOS >= 6 only, so is the subclass.
  • This project uses ARC. If you want to use it in a non ARC project, you must add the -fobjc-arc compiler flag to ARSpeechActivity.m in Target Settings > Build Phases > Compile Sources.

Installation

Add the ARSpeechActivity subfolder to your project. Add the AVFoundation framework to your proyect.

Usage

(See example Xcode project)

Simply alloc/init an instance of ARSpeechActivity and pass that object into the applicationActivities array when creating a UIActivityViewController.

NSString *textToRead = @"Hello World!";
ARSpeechActivity *speechActivity = [[ARSpeechActivity alloc] init];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[textToRead] applicationActivities:@[speechActivity]];
	[self presentViewController:activityViewController animated:YES completion:nil];

Note that you can include the activity in any UIActivityViewController and it will only be shown to the user if there is a NSString in the activity items.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].