<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ViewSpacing/formUnion(_:edges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11ViewSpacingV9formUnion_5edgesyAC_AA4EdgeO3SetVtF"
  },
  "title" : "formUnion(_:edges:)"
}
-->

# formUnion(_:edges:)

Merges the spacing preferences of another spacing instance with this
instance for a specified set of edges.

```
mutating func formUnion(_ other: ViewSpacing, edges: Edge.Set = .all)
```

## Parameters

`other`

Another spacing preferences instances to merge with this one.

`edges`

The edges to merge. Edges that you don’t specify are
unchanged after the method completes.

## Discussion

When you merge another spacing preference instance with this one,
this instance ends up with the greater of its original value or the
other instance’s value for each of the specified edges.
You can call the method repeatedly with each value in a collection to
merge a collection of preferences. The result has the smallest
preferences on each edge that meets the largest requirements of all
the inputs for that edge.

If you want to merge preferences without modifying the original
instance, use [`union(_:edges:)`](/documentation/SwiftUI/ViewSpacing/union(_:edges:)) instead.

---

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)