mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
Use elements to manifest an Array from an OrderedSet
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
This commit is contained in:
1 parent
7b37f7892b
commit
9ffceb3878
1 file changed
+1
-2
@@ -93,9 +93,8 @@ extension OrderedSet {
|
||||
/// is the number of changes contained by the parameter.
|
||||
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
||||
public func applying(_ difference: CollectionDifference<Element>) -> Self? {
|
||||
guard let array = Array(self).applying(difference) else { return nil }
|
||||
guard let array = self.elements.applying(difference) else { return nil }
|
||||
let result = OrderedSet(array)
|
||||
return result.count == array.count ? result : nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user