mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Update RiotSwiftUI symbols to triple slash documentation style with function annotations.
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
/**
|
||||
An Environment Key for retrieving runtime dependencies to be injected into `ObservableObjects`
|
||||
that are owned by a View (i.e. `@StateObject`'s, such as ViewModels owned by the View).
|
||||
*/
|
||||
/// An Environment Key for retrieving runtime dependencies.
|
||||
///
|
||||
/// Dependencies are to be injected into `ObservableObjects`
|
||||
/// that are owned by a View (i.e. `@StateObject`'s, such as ViewModels owned by the View).
|
||||
private struct DependencyContainerKey: EnvironmentKey {
|
||||
static let defaultValue = DependencyContainer()
|
||||
}
|
||||
@@ -36,12 +36,13 @@ extension EnvironmentValues {
|
||||
@available(iOS 14.0, *)
|
||||
extension View {
|
||||
|
||||
/**
|
||||
A modifier for adding a dependency to the SwiftUI view hierarchy's dependency container.
|
||||
Important: When adding a dependency to cast it to the type in which it will be injected.
|
||||
So if adding `MockDependency` but type at injection is `Dependency` remember to cast
|
||||
to `Dependency` first.
|
||||
*/
|
||||
/// A modifier for adding a dependency to the SwiftUI view hierarchy's dependency container.
|
||||
///
|
||||
/// Important: When adding a dependency to cast it to the type in which it will be injected.
|
||||
/// So if adding `MockDependency` but type at injection is `Dependency` remember to cast
|
||||
/// to `Dependency` first.
|
||||
/// - Parameter dependency: The dependency to add.
|
||||
/// - Returns: The wrapped view that now includes the dependency.
|
||||
func addDependency<T>(_ dependency: T) -> some View {
|
||||
transformEnvironment(\.dependencies) { container in
|
||||
container.register(dependency: dependency)
|
||||
|
||||
Reference in New Issue
Block a user