-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'qualif' into refactor/647_Code-Clean-Up
- Loading branch information
Showing
9 changed files
with
93 additions
and
19 deletions.
There are no files selected for viewing
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
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
32 changes: 32 additions & 0 deletions
32
OrangeDesignSystem/Sources/OrangeDesignSystem/Utils/AccessibleNavigationTitleModifier.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,32 @@ | ||
// | ||
// Software Name: Orange Design System | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT licence, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Design System | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
/// `ViewModifier` which defines a navigation title for the calling `View` and also use `UIAccessibility` to notify for screen changed. | ||
/// The title can be a wording key which will be localized. | ||
struct AccssibleNavigationTitleModifier: ViewModifier { | ||
|
||
let title: String | ||
|
||
func body(content: Content) -> some View { | ||
content | ||
.navigationTitle(title) | ||
.onAppear { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { | ||
UIAccessibility.post(notification: .screenChanged, argument: title) | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
OrangeDesignSystem/Sources/OrangeDesignSystem/Utils/View+extension.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,26 @@ | ||
// | ||
// Software Name: Orange Design System | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT licence, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Design System | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
extension View { | ||
|
||
/// Adds a modifier to the current `View` so as to define a naivgation title using the current `title` | ||
/// and also send a notification for accessibility layers for a change of screen when appeared. | ||
/// - Parameter title: The navigation title | ||
/// - Returns View: The view with a new modifier | ||
public func odsNavigationTitle(_ title: String) -> some View { | ||
self.modifier(AccssibleNavigationTitleModifier(title: title)) | ||
} | ||
} |
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
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
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
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
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