Skip to content

Commit

Permalink
refactor(review): doc, warnings, typo (#120)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
  • Loading branch information
pylapp committed Oct 4, 2024
1 parent 73c67eb commit 0c5caf4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import SwiftUI
/// `ViewModifier` which defines a navigation title for the calling `View` and also uses `UIAccessibility` to notify for screen changed.
struct AccessibleNavigationTitleModifier: ViewModifier {

/// The title used as a `LocalizedStringKey` to add as navigation title
let title: String

/// Elapsed time to wait before sending an accessibility notification of a screen change with the `title` in argument
let deadline: DispatchTime

func body(content: Content) -> some View {
Expand All @@ -34,9 +37,13 @@ struct AccessibleNavigationTitleModifier: ViewModifier {

// MARK: - Request Accessible Focus Modifier

/// `ViewModifier` to apply on a a `View` so as to request the focus after a given time.
struct RequestAccessibleFocusModifier: ViewModifier {

/// Flag to listen saying wether or not the `View` got the focus
@AccessibilityFocusState var requestFocus: Bool

/// Elapsed time to wait before requesting the focus
let deadline: DispatchTime

func body(content: Content) -> some View {
Expand All @@ -57,10 +64,16 @@ public enum AccessibilityFocusable: Hashable {

// MARK: - Restricted Request Accessible Focus Modifier

/// `ViewModifier` to apply on a `View` to request the focus on that `View` after a given time
struct RestrictedRequestAccessibleFocusModifier: ViewModifier {

/// Flag to listen saying wether or not the `View` got the focus
@AccessibilityFocusState var requestFocus: AccessibilityFocusable?

/// The target to give the focus after the deadLine` delay
let target: AccessibilityFocusable

/// Elapsed time to wait before requesting the focus
let deadline: DispatchTime

func body(content: Content) -> some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension View {
deadline: .now() + AccessibilityDelay.accessibleFocusRequestDelay.rawValue))
}

/// Adds a modifier to the current `View` so as to defer a focus request after the view is displayed for the given elment
/// Adds a modifier to the current `View` so as to defer a focus request after the view is displayed for the given element
/// - Parameters:
/// - requestFocus: The boolean binding (e.g. the `AccessibilityFocusState`)
/// - target: The item which will get the focus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ struct BorderModifier: ViewModifier {
// MARK: - Initializer

init(_ style: BorderStyleSemanticToken,
_ width: BorderWidthSemanticToken,
_ radius: BorderRadiusSemanticToken,
_ color: ColorSemanticToken) {
_ width: BorderWidthSemanticToken,
_ radius: BorderRadiusSemanticToken,
_ color: ColorSemanticToken) {
self.style = style
self.width = width
self.radius = radius
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import OUDSTokensSemantic
import SwiftUI

// MARK: - View extensions for typography

extension View {

/// Modifies the current `View` to apply a border.
Expand All @@ -25,7 +23,6 @@ extension View {
/// - width: The width of the border
/// - radius: The radius of the border to apply
/// - color: The colors of the border (depending to the `colorScheme`)
///
/// - Returns some View: The current `View` but with a border.
public func oudsBorder(
style: BorderStyleSemanticToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
//

// swiftlint:enable_rule sorted_imports

import SwiftUI
import OUDS
import OUDSTokensRaw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct TypographyTokenPage: View {
}

@ViewBuilder
private func typgraphyName(from namedTypography: NamedTypography) ->some View {
private func typgraphyName(from namedTypography: NamedTypography) -> some View {
switch namedTypography {
case .displayLarge:
Text(namedTypography.rawValue).typeDisplayLarge(theme)
Expand Down

0 comments on commit 0c5caf4

Please sign in to comment.