rightBarButtonItem
A custom bar button item that displays on the right (or trailing) edge of the navigation bar when the navigation item is the top item.
Declaration
var rightBarButtonItem: UIBarButtonItem? { get set }Discussion
The contents of this property always refer to the first bar button item in the rightBarButtonItems array. Assigning a new value to this property replaces the first item in the rightBarButtonItems array with the new value. Setting this property to nil removes the first item in the array. If the bar button item is already in the array, it is moved from its current location to the front of the array.
In a right-to-left user interface, the position of the right bar button item is automatically flipped.