diff options
| author | Fuwn <[email protected]> | 2025-07-05 06:36:16 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-07-05 06:36:16 -0700 |
| commit | fcf9ea89cf9190d4deb1e8e7223bf32a1f03b44f (patch) | |
| tree | caf89e739b6ce730eb2ff0f0ef060c00cb4f15e9 /Sora/Extensions | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-fcf9ea89cf9190d4deb1e8e7223bf32a1f03b44f.tar.xz sora-testing-fcf9ea89cf9190d4deb1e8e7223bf32a1f03b44f.zip | |
feat: Development commit
Diffstat (limited to 'Sora/Extensions')
| -rw-r--r-- | Sora/Extensions/Array+RemovingDuplicates.swift | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Sora/Extensions/Array+RemovingDuplicates.swift b/Sora/Extensions/Array+RemovingDuplicates.swift new file mode 100644 index 0000000..15fc697 --- /dev/null +++ b/Sora/Extensions/Array+RemovingDuplicates.swift @@ -0,0 +1,9 @@ +import Foundation + +extension Array where Element: Hashable { + func removingDuplicates() -> [Element] { + var seen = Set<Element>() + + return filter { seen.insert($0).inserted } + } +} |