Collection
extension Collection
-
Returns an optional element. If the
index
does not exist in the collection, the subscript returns nil.Declaration
Swift
public subscript(safe i: Index) -> Self.Iterator.Element? { get }
Parameters
safe
The index of the element to return, if it exists.
Return Value
An optional element from the collection at the specified index.
-
Returns an optional element. If the
index
does not exist in the collection, the function returns nil.Declaration
Swift
public func at(_ i: Index) -> Self.Iterator.Element?
Parameters
index
The index of the element to return, if it exists.
Return Value
An optional element from the collection at the specified index.