From ae7da9ee3b12a617aeeae1fefd8be1be84909de7 Mon Sep 17 00:00:00 2001 From: Tayeb Sedraia Date: Tue, 19 Nov 2024 15:49:27 +0100 Subject: [PATCH] review: specify default value case in code comment --- Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift | 2 ++ Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift | 2 ++ .../Showcase/Pages/Tokens/Dimension/Size/SizeTokenPage.swift | 3 +++ .../Pages/Tokens/Dimension/Space/SpaceTokenPage.swift | 4 ++++ .../Showcase/Pages/Tokens/Elevation/ElevationTokenPage.swift | 2 ++ Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift | 2 ++ .../Pages/Tokens/Typography/TypographyTokenPage.swift | 3 +++ 7 files changed, 18 insertions(+) diff --git a/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift index 93d232af3..9aba48ea1 100644 --- a/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Border/BorderTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift index 4878bc62e..ba75bac3a 100644 --- a/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Color/ColorTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Dimension/Size/SizeTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Dimension/Size/SizeTokenPage.swift index 9f72e5a74..d89045cfd 100644 --- a/Showcase/Showcase/Pages/Tokens/Dimension/Size/SizeTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Dimension/Size/SizeTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenPage.swift index f6d19e3e6..e770c8805 100644 --- a/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Dimension/Space/SpaceTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Elevation/ElevationTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Elevation/ElevationTokenPage.swift index 67e085ddd..c1031ef77 100644 --- a/Showcase/Showcase/Pages/Tokens/Elevation/ElevationTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Elevation/ElevationTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift index 6dd39d777..33ddbf1ed 100644 --- a/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Opacity/OpacityTokenPage.swift @@ -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 } diff --git a/Showcase/Showcase/Pages/Tokens/Typography/TypographyTokenPage.swift b/Showcase/Showcase/Pages/Tokens/Typography/TypographyTokenPage.swift index dd428d0ef..2ec74200b 100644 --- a/Showcase/Showcase/Pages/Tokens/Typography/TypographyTokenPage.swift +++ b/Showcase/Showcase/Pages/Tokens/Typography/TypographyTokenPage.swift @@ -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 }