RangeReplaceableCollection
extension RangeReplaceableCollection
extension RangeReplaceableCollection where Self: BidirectionalCollection
-
Replace element at given
indexwith the givenelement.Declaration
Swift
@discardableResult public mutating func replaceElement(at index: Index, with element: Element) -> Element -
Immutable version of
replaceElement(at:with:)Declaration
Swift
public func replacingElement(at index: Index, with element: Element) -> Self -
Replace first element in Array with a new element.
Declaration
Swift
@discardableResult public mutating func replaceFirst(with element: Element) -> Element -
Declaration
Swift
public func inserting(_ element: Element, at index: Index) -> SelfReturn Value
A new
Arraywith the givenelementinserted at the givenindex, if possible.
-
Replace the last element in
Selfwith the givenelement.Declaration
Swift
@discardableResult public mutating func replaceLast(with element: Element) -> Element
View on GitHub
Install in Dash
RangeReplaceableCollection Extension Reference