callAsFunction() { action() } } extension EnvironmentValues { var countUp: CountUpAction { .init { _count.wrappedValue += 1 } } } struct CountView: View { // ... @Environment(\.countUp) var countUp var body: some View { VStack { Text("Count: \(count)") .foregroundStyle(color.title) Button("Increment") { countUp() } } } } #Preview { @Previewable @State var previewCount: Int = 0 CountView() .environment(\._count, $previewCount) .environment(\.countUp, .init(action: { /* ... */ })) } 🙅 ᇿೆીႵ4FUUFS֥&OW