Array

public extension Array
public extension Array where Element: Equatable
public extension Array where Element == Int
public extension Array where Element == NSAttributedString
  • Returns the element in the given index. Returns nil if index is invalid.

    Declaration

    Swift

    func get(_ index: Index) -> Element?

    Parameters

    index

    Array index

    Return Value

    Array element

Pair elements

  • Pairs an element and next element in the array

    Declaration

    Swift

    var pairs: AnySequence<(Element, Element?)> { get }

Empty Array Check

  • Checks if the array is not empty.

    Declaration

    Swift

    var isNotEmpty: Bool { get }

Available where Element: Equatable

  • Removes given element if it is in this array. Otherwise it does nothing.

    Declaration

    Swift

    mutating func remove(element: Element)

Available where Element == Int

  • Increments value at index by given value. It is thread-unsafe.

    Declaration

    Swift

    mutating func increment(at index: Index, by: Element = 1)
  • Decrements value at index by given value. It is thread-unsafe.

    Declaration

    Swift

    mutating func decrement(at index: Index, by: Element = 1)

Available where Element == NSAttributedString

  • Join elements with a separator in a NSAttributedString

    Declaration

    Swift

    func joined(separator: Element) -> Element

    Parameters

    separator

    Combiner element

    Return Value

    Joined elements in the NSAttributedString