-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1fa61a
commit d70a793
Showing
12 changed files
with
690 additions
and
515 deletions.
There are no files selected for viewing
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
...yHandbook.docc/Pages/Adaption/Basic/Describe/AccessibilityAttributes/Frame/Frame.tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@Tutorial(time: <#number#>) { | ||
@Intro(title: "<#text#>") { | ||
<#text#> | ||
|
||
@Image(source: <#file#>, alt: "<#accessible description#>") | ||
} | ||
|
||
@Section(title: "<#text#>") { | ||
@ContentAndMedia { | ||
<#text#> | ||
|
||
@Image(source: <#file#>, alt: "<#accessible description#>") | ||
} | ||
|
||
@Steps { | ||
@Step { | ||
<#text#> | ||
|
||
@Image(source: <#file#>, alt: "<#accessible description#>") | ||
} | ||
|
||
@Step { | ||
<#text#> | ||
|
||
@Code(name: "<#display name#>", file: <#filename.swift#>) | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...Pages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/SwiftUI/addTraits.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
struct ContentView: View { | ||
var body: some View { | ||
VStack { | ||
Text("WWDC 2021") | ||
.accessibilityAddTraits(.isHeader) | ||
|
||
Text("SwiftUI Accessibility") | ||
Text("Beyond the Basics") | ||
|
||
Image(systemName: "checkmark.seal.fill") | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...aption/Basic/Describe/AccessibilityAttributes/Traits/Code/SwiftUI/allowsDirectTouch.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import SwiftUI | ||
|
||
struct KeyboardKeyView: View { | ||
var soundFile: String | ||
var body: some View { | ||
Rectangle() | ||
.fill(.white) | ||
.frame(width: 35, height: 80) | ||
.onTapGesture(count: 1) { | ||
playSound(sound: soundFile, type: "mp3") | ||
} | ||
.accessibilityDirectTouch(options: .silentOnTouch) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...es/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/SwiftUI/budgetSlider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import SwiftUI | ||
|
||
var body: some View { | ||
VStack { | ||
SliderTrack(...) // Custom slider implementation. | ||
} | ||
.accessibilityRepresentation { | ||
Slider(value: $value, in: 0...100) { | ||
Text("Label") | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../Pages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/SwiftUI/isToggle.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import SwiftUI | ||
|
||
struct FilterButton: View { | ||
@State var filter: Bool = false | ||
|
||
var body: some View { | ||
Button(action: { filter.toggle() }) { | ||
Text("Filter") | ||
} | ||
.background(filter ? darkGreen : lightGreen) | ||
.accessibilityAddTraits(.isToggle) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...Pages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/UIKit/directTouch.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import UIKit | ||
|
||
class ViewController: UIViewController { | ||
let waveformButton = UIButton(type: .custom) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
waveformButton.accessibilityTraits = .allowsDirectInteraction | ||
waveformButton.accessibilityDirectTouchOptions = .silentOnTouch | ||
waveformButton.addTarget(self, action: #selector(playTone), for: .touchUpInside) | ||
|
||
view.addSubview(waveformButton) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/UIKit/hiddenTraits.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import UIKit | ||
|
||
private func getHiddenTrait( | ||
forIndex index: UInt64) -> UIAccessibilityTraits { | ||
let traitRaw: UInt64 = 1 << index | ||
return UIAccessibilityTraits( | ||
rawValue: traitRaw) | ||
} | ||
|
||
let hiddenTraits = [ | ||
19: "pickeritem", | ||
20: "radio button", | ||
23: "status bar item", | ||
25: "inactive", | ||
26: "footer", | ||
28: "tab", | ||
32: "visited", | ||
35: "tap and hold, then move up and down to select index", | ||
38: "draggable", | ||
39: "learning", | ||
40: "pop-up button", | ||
42: "maths", | ||
45: "hide from focus", | ||
50: "folder", | ||
52: "menu item", | ||
53: "double tap to toggle settings", | ||
59: "video playback", | ||
60: "icon", | ||
] |
8 changes: 8 additions & 0 deletions
8
...c/Pages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/UIKit/optionSet.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// optionSet.swift | ||
// | ||
// | ||
// Created by admin on 03.03.2024. | ||
// | ||
|
||
import Foundation |
15 changes: 15 additions & 0 deletions
15
...ages/Adaption/Basic/Describe/AccessibilityAttributes/Traits/Code/UIKit/toggleButton.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import UIKit | ||
|
||
class ViewController: UIViewController { | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
let filterButton = UIButton(type: .custom) | ||
|
||
setupButtonView() | ||
|
||
filterButton.accessibilityTraits = [.toggleButton] | ||
|
||
view.addSubview(filterButton) | ||
} | ||
} |
Oops, something went wrong.