Skip to content

Commit

Permalink
Changed addAccessibilitySpeechPhoneticNotation to accessibilityIPA
Browse files Browse the repository at this point in the history
Added accessibilityIPA to String
  • Loading branch information
ryanlintott committed Jun 22, 2022
1 parent 4fa32b6 commit 0737422
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public extension AttributedString {
/// Adds accessible phonetic pronunciation for specified phrases.
/// - Parameter phrases: Dictionary of phrases and ipa pronunciations for those phrases
/// - Returns: `AttributedString` with accessible phonetic pronunciations for specified phrases
func addAccessibilitySpeechPhoneticNotation(_ phrases: [String: String], voice: OEVoice = .default) -> Self {
func accessibilityIPA(_ phrases: [String: String]) -> Self {
var attributedString = self

phrases.forEach { phrase in
Expand Down
9 changes: 9 additions & 0 deletions Sources/OEVoice/extensions/String-extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ public extension String {
NSMutableAttributedString(string: self).accessibilityOldEnglishIPA(ipa, voice: voice)
}
}

@available(iOS 15, *)
public extension String {
/// Adds accessible phonetic pronunciation for specified phrases.
/// - Parameter phrases: Dictionary of phrases and ipa pronunciations for those phrases
/// - Returns: `AttributedString` with accessible phonetic pronunciations for specified phrases
func accessibilityIPA(_ phrases: [String: String], voice: OEVoice = .default) -> AttributedString { AttributedString(self).accessibilityIPA(phrases)
}
}

0 comments on commit 0737422

Please sign in to comment.