---
title: "reduce(value:nextValue:)"
framework: swiftui
role: symbol
role_heading: Type Method
path: "swiftui/preferencekey/reduce(value:nextvalue:)"
---

# reduce(value:nextValue:)

Combines a sequence of values by modifying the previously-accumulated value with the result of a closure that provides the next value.

## Declaration

```swift
static func reduce(value: inout Self.Value, nextValue: () -> Self.Value)
```

## Parameters

- `value`: The value accumulated through previous calls to this method. The implementation should modify this value.
- `nextValue`: A closure that returns the next value in the sequence.

## Discussion

Discussion This method receives its values in view-tree order. Conceptually, this combines the preference value from one tree with that of its next sibling.
