Array

public extension Array
public extension Array where Element: Equatable
  • Second element in array

    Declaration

    Swift

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

    Declaration

    Swift

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

Scripting

  • 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)

Splitting

  • Splits array into slices of specified size

    Declaration

    Swift

    func splittedArray(splitSize: Int) -> [[Element]]

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) -> [Element]
  • Helper method to remove all objects that are equal to those contained in contentsOf array.

    Declaration

    Swift

    @inlinable
    mutating func removeAll(contentsOf array: [Element])
  • 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) -> [Element]
  • Returns array removing all objects that are equal to those contained in array.

    Declaration

    Swift

    @inlinable
    func removingAll(contentsOf array: [Element]) -> [Element]
  • 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]) -> [Element]