-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Oguz Yuksel <oguz.yueksel@teufel.de>
- Loading branch information
1 parent
9dbbdf2
commit 550f4fa
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
Sources/FoundationExtensions/A11y/AccessibilityIdentifiable.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,3 @@ | ||
// Copyright © 2023 Lautsprecher Teufel GmbH. All rights reserved. | ||
|
||
public protocol AccessibilityIdentifiable: TypePathConvertible { } |
28 changes: 28 additions & 0 deletions
28
Sources/FoundationExtensions/A11y/AccessibilityIdentifier.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,28 @@ | ||
// Copyright © 2023 Lautsprecher Teufel GmbH. All rights reserved. | ||
|
||
/// A namespace for accessibility identifiers. | ||
/// | ||
/// You could declare A11Y IDs like this | ||
/// ``` | ||
/// extension AccessibilityIdentifier { | ||
/// enum HomeScreen: AccessibilityIdentifiable { | ||
/// enum MusicView: AccessibilityIdentifiable { | ||
/// case sectionHeader | ||
/// case recentlyPlayedScrollview | ||
/// } | ||
/// | ||
/// enum MiniPlayer: AccessibilityIdentifiable { | ||
/// case muteButton | ||
/// case coverImage | ||
/// } | ||
/// } | ||
/// } | ||
/// ``` | ||
/// Thanks to the TypePathConvertible conformance, you can use it on your views: | ||
/// ``` | ||
/// Text("Podcasts") | ||
/// .accessibilityIdentifier(AccessibilityIdentifier.HomeScreen.MusicView.sectionHeader.typePath) | ||
/// ``` | ||
/// which adds the A11Y ID "MyApp.AccessibilityIdentifier.HomeScreen.MusicView.sectionHeader" to the View. | ||
/// | ||
public enum AccessibilityIdentifier: AccessibilityIdentifiable { } |