Class

NSCollectionLayoutEdgeSpacing

An object that defines the space around the edges of items in a collection view.

Declaration

class NSCollectionLayoutEdgeSpacing : NSObject

Overview

You use edge spacing to create additional spacing around the edges of an item to adjust the position of the item in relation to its container and other items.

The leading and trailing spaces within edge spacing differ in left-to-right versus right-to-left environments. In a left-to-right environment, the leading space is on the left, and the trailing space is on the right. In a right-to-left environment, the leading space is on the right, and the trailing space is on the left. This difference ensures that your collection view layout is built with support for right-to-left languages.

The following diagram shows the difference between adding 2 points of trailing edge spacing in a left-to-right versus a right-to-left environment.

Two diagrams that compare edge spacing in a left-to-right and a right-to-left environment. Both diagrams show a group of three square items in a row. The first diagram, labeled trailing in left-to-right environment, shows trailing space on the right of each item, implying that leading space is on the left. The second diagram, labeled trailing in right-to-left environment, shows trailing space on the left of each item, implying that leading space is on the right.

Topics

Creating Edge Spacing

Getting the Edge Spacing

var leading: NSCollectionLayoutSpacing?

The leading edge spacing value.

var top: NSCollectionLayoutSpacing?

The top edge spacing value.

var trailing: NSCollectionLayoutSpacing?

The trailing edge spacing value.

var bottom: NSCollectionLayoutSpacing?

The bottom edge spacing value.

Relationships

Inherits From

See Also

Size and Spacing

class NSCollectionLayoutDimension

An individual dimension of an item's size (width or height) in a collection view.

class NSCollectionLayoutSize

The width and the height of an item in a collection view.

class NSCollectionLayoutSpacing

An object that defines the space between or around items in a collection view.

protocol NSCollectionLayoutContainer

A protocol used to provide information about the size and content insets of a layout's container.