Update RiotSwiftUI symbols to triple slash documentation style with function annotations.

This commit is contained in:
David Langley
2021-09-13 11:36:33 +01:00
parent 886bb98eb1
commit 3d65fbd48f
39 changed files with 184 additions and 240 deletions
@@ -17,13 +17,11 @@
import Foundation
import DesignKit
/**
Extension to `ThemeIdentifier` for getting the SwiftUI theme.
*/
@available(iOS 14.0, *)
extension ThemeIdentifier {
fileprivate static let defaultTheme = DefaultThemeSwiftUI()
fileprivate static let darkTheme = DarkThemeSwiftUI()
/// Extension to `ThemeIdentifier` for getting the SwiftUI theme.
public var themeSwiftUI: ThemeSwiftUI {
switch self {
case .light:
@@ -31,25 +31,21 @@ extension EnvironmentValues {
}
}
/**
A theme modifier for setting the theme for this view and all its descendants in the hierarchy.
- Parameters:
- theme: a Theme to be set as the environment value.
*/
@available(iOS 14.0, *)
extension View {
/// A theme modifier for setting the theme for this view and all its descendants in the hierarchy.
/// - Parameter theme: A theme to be set as the environment value.
/// - Returns: The target view with the theme applied.
func theme(_ theme: ThemeSwiftUI) -> some View {
environment(\.theme, theme)
}
}
/**
A theme modifier for setting the theme by id for this view and all its descendants in the hierarchy.
- Parameters:
- themeId: ThemeIdentifier of a theme to be set as the environment value.
*/
@available(iOS 14.0, *)
extension View {
/// A theme modifier for setting the theme by id for this view and all its descendants in the hierarchy.
/// - Parameter themeId: ThemeIdentifier of a theme to be set as the environment value.
/// - Returns: The target view with the theme applied.
func theme(_ themeId: ThemeIdentifier) -> some View {
return environment(\.theme, themeId.themeSwiftUI)
}
@@ -17,11 +17,10 @@
import Foundation
import Combine
/**
Provides the theme and theme updates to SwiftUI.
Replaces the old ThemeObserver. Riot app can push updates to this class
removing the dependency of this class on the `ThemeService`.
*/
/// Provides the theme and theme updates to SwiftUI.
///
/// Replaces the old ThemeObserver. Riot app can push updates to this class
/// removing the dependency of this class on the `ThemeService`.
@available(iOS 14.0, *)
class ThemePublisher: ObservableObject {