Array

extension Array
  • Conditionally remove each element depending on the elements immediately preceding and following it.

    Declaration

    Swift

    mutating mutating func removeSeparators(where shouldBeRemoved: (Element?, Element, Element?) throws -> Bool) rethrows

    Parameters

    shouldBeRemoved

    A closure that is called once for each element in reverse order from last to first. The closure accepts the following arguments: the preceding element in the (unreversed) array, the element itself, and the following element in the (unreversed) array.

  • Returns a new attributed string by concatenating the elements of the array, adding the given separator between each element.

    Declaration

    Swift

    func joined(separator: NSAttributedString = .init()) -> NSAttributedString