Skip to content

Commit

Permalink
review: specify default value case in code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayebsed93 committed Nov 19, 2024
1 parent 5c5bdbb commit ae7da9e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ struct BorderTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}
Expand Down
2 changes: 2 additions & 0 deletions Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ struct ColorTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,21 @@ struct SizeTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}

/// Computed property for horizontalSizeClass
/// Returns `forcedHorizontalSizeClass` if available, otherwise falls back to the environment `horizontalSizeClass`
/// If neither is available, `.regular` is used as the default value.
var activeHorizontalSizeClass: UserInterfaceSizeClass {
forcedHorizontalSizeClass ?? horizontalSizeClass ?? .regular
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,28 @@ struct SpaceTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}

/// Computed property for horizontalSizeClass
/// Returns `forcedHorizontalSizeClass` if available, otherwise falls back to the environment `horizontalSizeClass`
/// If neither is available, `.regular` is used as the default value.
var activeHorizontalSizeClass: UserInterfaceSizeClass {
forcedHorizontalSizeClass ?? horizontalSizeClass ?? .regular
}

/// Computed property for verticalSizeClass
/// Returns `forcedVerticalSizeClass` if available, otherwise falls back to the environment `verticalSizeClass`
/// If neither is available, `.compact` is used as the default value.
var activeVerticalSizeClass: UserInterfaceSizeClass {
forcedVerticalSizeClass ?? verticalSizeClass ?? .compact
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ struct ElevationTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}
Expand Down
2 changes: 2 additions & 0 deletions Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ struct OpacityTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ struct TypographyTokenPage: View {

/// Computed property for colorScheme
/// Returns `forcedColorScheme` if available, otherwise falls back to the environment `colorScheme`
/// If neither is available, the default system `colorScheme` will be applied.
var activeColorScheme: ColorScheme {
forcedColorScheme ?? colorScheme
}

/// Computed property for theme
/// Returns `forcedTheme` if available, otherwise falls back to the environment `theme`
/// If neither is available, the default `theme` will be applied.
var activeTheme: OUDSTheme {
forcedTheme ?? theme
}

/// Computed property for horizontalSizeClass
/// Returns `forcedHorizontalSizeClass` if available, otherwise falls back to the environment `horizontalSizeClass`
/// If neither is available, `.regular` is used as the default value.
var activeHorizontalSizeClass: UserInterfaceSizeClass {
forcedHorizontalSizeClass ?? horizontalSizeClass ?? .regular
}
Expand Down

0 comments on commit ae7da9e

Please sign in to comment.