RangeReplaceableCollection

public extension RangeReplaceableCollection
public extension RangeReplaceableCollection where Element: Equatable
public extension RangeReplaceableCollection where Self: BidirectionalCollection
public extension RangeReplaceableCollection where Index == Int, Self: BidirectionalCollection
public extension RangeReplaceableCollection where Element: Equatable, Self: BidirectionalCollection
  • Helper method to modify all value type objects in array

    Declaration

    Swift

    @inlinable
    mutating func modifyForEach(_ body: (_ index: Index, _ element: inout Element) throws -> ()) rethrows
  • Helper method to modify value type objects in array at specific index

    Declaration

    Swift

    @inlinable
    mutating func modifyElement(atIndex index: Index, _ modifyElement: (_ element: inout Element) throws -> ()) rethrows
  • Helper methods to remove object using closure

    Declaration

    Swift

    @discardableResult
    @inlinable
    mutating func remove(_ body: (_ element: Element) throws -> Bool) rethrows -> Element?
  • Undocumented

    Declaration

    Swift

    @inlinable
    mutating func move(from: Index, to: Index)

Available where Element: Equatable

  • Helper method to remove all objects that are equal to passed one.

    Declaration

    Swift

    @inlinable
    mutating func removeAll(_ element: Element)
  • Returns array removing all objects that are equal to passed one.

    Declaration

    Swift

    @inlinable
    func removingAll(_ element: Element) -> Self
  • Helper method to remove all objects that are equal to those contained in contentsOf array.

    Declaration

    Swift

    @inlinable
    mutating func removeAll(contentsOf array: [Element])
  • Returns array removing all objects that are equal to those contained in array.

    Declaration

    Swift

    @inlinable
    func removingAll(contentsOf array: [Element]) -> Self
  • Helper method to append missing elements from passed array.

    Declaration

    Swift

    @inlinable
    mutating func appendMissing(contentsOf array: [Element])
  • Returns array appending missing elements from passed array.

    Declaration

    Swift

    @inlinable
    func appendingMissing(contentsOf array: [Element]) -> Self

Available where Self: BidirectionalCollection

  • Replaces last element with new element and returns replaced element.

    Declaration

    Swift

    @discardableResult
    mutating func replaceLast(_ element: Element) -> Element

Available where Index == Int, Self: BidirectionalCollection

  • Second element in array

    Declaration

    Swift

    var second: Element? { get }
  • Third element in a collection

    Declaration

    Swift

    var third: Element? { get }
  • Fourth element in a collection

    Declaration

    Swift

    var fourth: Element? { get }
  • Replaces last element with new element and returns replaced element.

    Declaration

    Swift

    @discardableResult
    mutating func replaceLast(_ element: Element) -> Element

Available where Element: Equatable, Self: BidirectionalCollection

  • Removes the last object that is equal to a passed one.

    Declaration

    Swift

    @inlinable
    mutating func removeLast(_ element: Element)
  • Returns array removing the last object that is equal to a passed one.

    Declaration

    Swift

    @inlinable
    func removingLast(_ element: Element) -> Self