From 097ab857cbb4095a673259896f30ffe494eac241 Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 5 Nov 2023 08:02:10 -0700 Subject: [PATCH] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4c6ae8..981d8a9 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,8 @@ Here's an example: ```swift class DataService: ObservableObject { @AppState(\.someData) var data: [String] + + func fetchData() { ... } } extension Application { @@ -196,7 +198,7 @@ In this example, whenever data in `DataService` changes, SwiftUI automatically u One of the great advantages of using `Dependency` in AppState is the capability to replace dependencies with mock versions during testing. This is incredibly useful for isolating parts of your application for unit testing. -You can replace a dependency by calling the `override(_:_:)` function. This function returns a `DependencyOverrideToken`, you'll want to hold onto this token for as long as you want the mock dependency to be effective. When the token is deallocated, the dependency reverts back to its original condition. +You can replace a dependency by calling the `Application.override` function. This function returns a `DependencyOverride`, you'll want to hold onto this token for as long as you want the mock dependency to be effective. When the token is deallocated, the dependency reverts back to its original condition. Here's an example: