An object that defines the space between or around items in a collection view.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
In a collection view layout, you use a spacing object to specify both the amount of space and the way in which it's calculated.
You can express spacing using fixed or flexible spacing.
Use fixed spacing to provide an exact amount of space. For example, the following code creates exactly 200 points of space between the items in the group.
Use flexible spacing to provide a minimum amount of space that can grow as more space becomes available. For example, the following code creates at least 200 points of space between the items in the group. As more space becomes available, items are respaced evenly in the additional space.