Collection
public extension Collection
-
Search contains index of array, if it exists returns element otherwise returns nil. That extension prevents fatal error about index out of range
Declaration
Swift
subscript(safe index: Index) -> Element? { get }
Parameters
index
Index tried to be accessed
Return Value
The element at index