The last element of the collection.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Discussion
If the collection is empty, the value of this property is nil
.
Complexity: O(1)
The last element of the collection.
SDK
Framework
If the collection is empty, the value of this property is nil
.
Complexity: O(1)
subscript(Int) -> Element
Accesses the element at the specified position.
var first: Element?
The first element of the collection.
subscript(Range<Int>) -> Array Slice<Element>
Accesses a contiguous subrange of the array’s elements.
subscript(Range<Int>) -> Slice<Array<Element>>
Accesses a contiguous subrange of the collection’s elements.
subscript<R>(R) -> Array Slice<Element>
Accesses the contiguous subrange of the collection’s elements specified by a range expression.
func random Element() -> Element?
Returns a random element of the collection.
func random Element<T>(using: inout T) -> Element?
Returns a random element of the collection, using the given generator as a source for randomness.