Creates and returns an attachment behavior where two items are fixed to points that slide along the specified axis.
- iOS 9.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
The first of two dynamic items connected by the attachment behavior.
The second of two dynamic items connected by the attachment behavior.
The initial anchor point for both items. Specify this point in the coordinate system of the dynamic animator’s reference view. For more information about coordinate systems, see
The axis of translation, along which the anchor points of the items slide.
A new attachment object or
nil if the object could not be created.
For this behavior, each item acts like it is at the end of a solid rod attached to its anchor point. Both items start with the same anchor point, but as animations progress, each item’s anchor point is allowed to slide along the specified axis of translation independently. So if one item moves, it pushes the translation axis and the other item with it. The items do not rotate relative to the axis of translation or to each other, but the proximity of the items to one another varies depending on the movement of each item’s anchor point along the translation axis.
The axis of translation is infinitely long initially, but you can change the length by assigning a new value to the
attachment property. When specifying a new attachment range, remember that the value in point represents the value
0 on the axis. Any new range you specify must include