Collection
protocol Collection : Sequence where Self.SubSequence : Collection
-
Deprecated: Please use
getSafely(at:)
instead.Refer to the documentation for
getSafely(at:)
for more info.Declaration
Swift
@available(*, deprecated, renamed: "getSafely(at:﹚") public func getSafely(_ index: Self.Index) -> Self.Iterator.Element?
-
Try to get the item at index
index
. If the index is out of bounds,nil
is returned.Parameter index: The index of the item to tentatively get. Returns: The element as a wrapped optional if the
index
is in theindices
of the collection,nil
otherwiseDeclaration
Swift
public func getSafely(at index: Self.Index) -> Self.Iterator.Element?
-
Returns a collection with same element, and information as to whether the element is the first or the last, or both.
Declaration
Swift
public func withPositionInformation() -> [(element: Self.Element, isFirstElement: Bool, isLastElement: Bool)]