diff --git a/SessionUtilitiesKit/General/Array+Utilities.swift b/SessionUtilitiesKit/General/Array+Utilities.swift index 0b4d8b7fd..fc5bfbc6f 100644 --- a/SessionUtilitiesKit/General/Array+Utilities.swift +++ b/SessionUtilitiesKit/General/Array+Utilities.swift @@ -1,11 +1,27 @@ +import Foundation -public extension Array where Element : CustomStringConvertible { - +public extension Array where Element: CustomStringConvertible { var prettifiedDescription: String { return "[ " + map { $0.description }.joined(separator: ", ") + " ]" } } +public extension Array { + func appending(_ other: Element) -> [Element] { + var updatedArray: [Element] = self + updatedArray.append(other) + + return updatedArray + } + + func appending(_ other: [Element]) -> [Element] { + var updatedArray: [Element] = self + updatedArray.append(contentsOf: other) + + return updatedArray + } +} + public extension Array where Element: Hashable { func asSet() -> Set { return Set(self)