<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/PreferenceKey/reduce(value:nextValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13PreferenceKeyP6reduce5value9nextValuey0H0Qzz_AHyXEtFZ"
  },
  "title" : "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.

```
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

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)