Array

extension Array
extension Array where Element == String?
extension Array where Element == AttributeModel

from: https://stackoverflow.com/questions/50264717/get-all-possible-combination-of-items-in-array-without-duplicate-groups-in-swift/50264766

  • Undocumented

    Declaration

    Swift

    var powerSet: [[Element]] { get }

Available where Element == String?

  • Joins all Strings in Array but skips empty values

    Declaration

    Swift

    func skipEmptyJoined(separator: String = "") -> String

    Parameters

    separator

    separator String

    Return Value

    Joined String

Available where Element == AttributeModel

  • Sorts the array of AttributeModels and maps the transform operation

    Declaration

    Swift

    func sortedMap<T>(_ transform: (Element) -> T) -> [T]

    Parameters

    transform

    method to be executed on each element of array

    Return Value

    sorted & mapped array