---
title: "union(_:edges:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/viewspacing/union(_:edges:)"
---

# union(_:edges:)

Gets a new value that merges the spacing preferences of another spacing instance with this instance for a specified set of edges.

## Declaration

```swift
func union(_ other: ViewSpacing, edges: Edge.Set = .all) -> ViewSpacing
```

## Parameters

- `other`: Another spacing preferences instance to merge with this one.
- `edges`: The edges to merge. Edges that you don’t specify are unchanged after the method completes.

## Return Value

Return Value A new view spacing preferences instance with the merged values.

## Discussion

Discussion This method behaves like formUnion(_:edges:), except that it creates a copy of the original spacing preferences instance before merging, leaving the original instance unmodified.

## See Also

### Merging spacing instances

- [formUnion(_:edges:)](swiftui/viewspacing/formunion(_:edges:).md)
