Skip to content

Latest commit

ย 

History

History
69 lines (52 loc) ยท 2.72 KB

Creating_an_Accessible_Reading_Experience.md

File metadata and controls

69 lines (52 loc) ยท 2.72 KB

@ WWDC19

ํ›Œ๋ฅญํ•œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ํŠน์ง• > ๋›ฐ์–ด๋‚œ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค

  • ๋งŽ์€ ์–‘์˜ ํ…์ŠคํŠธ๋ฅผ ์ฝ๋Š” ๊ฒƒ์— ์ดˆ์ ์„ ๋‘” ์•ฑ์˜ ๊ฒฝ์šฐ ํ…์ŠคํŠธ์˜ ๋ ˆ์ด์•„์›ƒ ๋ฐ ์Šคํƒ€์ผ๋ง์ด ํ•„์š”ํ•จ
  • ์—ฌ๊ธฐ์— Accessability๋ฅผ ๋”ํ•˜๋ฉด ๋”์šฑ ์ข‹์Œ VoiceOver์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ฑ์ด ๋›ฐ์–ด๋‚œ ์ฝ๊ธฐ ํ™˜๊ฒฝ์„ ๋งŒ๋“œ๋Š” ๋ฐ ํ•„์š”ํ•œ API ๋ฐ ๊ธฐ์ˆ ์— ๋Œ€ํ•ด ๋ฐฐ์›๋‹ˆ๋‹ค.
  • VoiceOver ์ผœ๊ธฐ

Reading Content Protocol

  • UIAccessibilityLocationDescriptor ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ…์ŠคํŠธ ๋‚ด์šฉ์— ์•ก์„ธ์Šค ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
public protocol UIAccessibilityReadingContent {

 // ํฌ์ธํŠธ์˜ ๊ฒฝ์šฐ ์ง€์ •๋œ ํ„ฐ์น˜ ์œ„์น˜์— ๋Œ€ํ•œ ํ–‰ ๋ฒˆํ˜ธ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. 
 func accessibilityLineNumber(for point: CGPoint) -> Int

 // forLineNumber๋Š” ํ…์ŠคํŠธ ๋‚ด์šฉ์„ ์š”์ฒญํ•˜๊ณ  ์ง€์ •๋œ ํ–‰์„ ๊ฐ๊ฐ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค. 
 func accessibilityContent(forLineNumber lineNumber: Int) -> String?

 // accessibility Frame์ด ์–ด๋””์ธ์ง€ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.
 func accessibilityFrame(forLineNumber lineNumber: Int) -> CGRect
 
 // ๋‚ด์šฉ์˜ ์ „์ฒด ํŽ˜์ด์ง€๋ฅผ return
 func accessibilityPageContent() -> String?

}
  • view ์ดˆ๊ธฐํ™”์‹œ isAccessibilityElement๋ฅผ true๋กœ ์„ค์ •์ผœ์ฃผ๊ธฐ
    • accessibilityLineNumber(for point: CGPoint) ์—์„œ view๋ฅผ ์„ค๋ช…ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ’์„ ๋„˜๊ฒจ์ค€๋‹ค.
    • accessibilityPageContent ๋ฌธ์ž์—ด๋“ค์„ ๋ชจ์•„์„œ ๋„˜๊ฒจ์ค€๋‹ค.

Automatic Page Turning

โ€ข ์ž๋™ ํŽ˜์ด์ง€ ๋„˜๊น€์„ ๊ตฌํ˜„ํ•˜๋ ค๋ฉด 2 ๊ฐœ์˜ ์ ‘๊ทผ์„ฑ API๋ฅผ ์ฑ„ํƒํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

  • vie์— causePageTurn ์ ‘๊ทผ์„ฑ ํŠน์„ฑ์„ ํฌํ•จ์‹œ์ผœ์•ผํ•ฉ๋‹ˆ๋‹ค.
  • accessibilityScroll๊ณผ direction๋ฅผ ์„ค์ •ํ•ด์„œ ์Šคํฌ๋กค ๋ฐฉํ–ฅ์„ ๊ตฌํ˜„ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.
UIAccessibilityTraits.causesPageTurn

func accessibilityScroll(_ direction: UIAccessibilityScrollDirection) -> Bool 

Customizing Speech

  • VoiceOver๊ฐ€ ์•ฑ์˜ ์ปจํ…์ธ ๋ฅผ ๋งํ•˜๋Š” ๋ฐฉ์‹์„ ์ œ์–ด ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
public protocol UIAccessibilityReadingContent {

 func accessibilityAttributedContent(forLineNumber lineNumber: Int) -> NSAttributedString?

 func accessibilityAttributedPageContent() -> NSAttributedString?

}

ํŠน์ • ๊ตฌ์ ˆ์„ ์ฝ์„ ์–ธ์–ด ์„ค์ •ํ•˜๊ธฐ

NSAttributedString(string: "Arc de Triomphe", attributes: [.accessibilitySpeechLanguage:
โ€œfr-FRโ€])

accessibilitySpeechIPANotation ์‚ฌ์šฉํ•ด์„œ IPA representation ์ถ”๊ฐ€ํ•˜๊ธฐ

let label = NSMutableAttributedString(string: "Yosemite National Park")
let range = label.string.range(of: "Yosemite")!
label.addAttributes([.accessibilitySpeechIPANotation: "joสŠหˆsษ›mษชti"], range:NSRange(range, in:
label.string))