session-ios/SessionUtilitiesKit/General/Set+Utilities.swift
Morgan Pretty 0db74ce1e3 Working on the MediaGallery and ClosedGroup handling
Fixed a couple of issues around the duplicate messages handling
Fixed a few issues with ClosedGroup polling and ClosedGroup control message handling
Started working through updating the MediaGallery
2022-05-08 22:01:39 +10:00

32 lines
885 B
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
public extension Set {
func inserting(_ value: Element?) -> Set<Element> {
guard let value: Element = value else { return self }
var updatedSet: Set<Element> = self
updatedSet.insert(value)
return updatedSet
}
func inserting(contentsOf value: Set<Element>?) -> Set<Element> {
guard let value: Set<Element> = value else { return self }
var updatedSet: Set<Element> = self
value.forEach { updatedSet.insert($0) }
return updatedSet
}
func removing(_ value: Element?) -> Set<Element> {
guard let value: Element = value else { return self }
var updatedSet: Set<Element> = self
updatedSet.remove(value)
return updatedSet
}
}