Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
16 lines
341 B
Swift
16 lines
341 B
Swift
//
|
|
// SequenceExtension.swift
|
|
//
|
|
//
|
|
// Created by Thibaut Schmitt on 04/01/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public extension Sequence where Iterator.Element: Hashable {
|
|
func unique() -> [Iterator.Element] {
|
|
var seen: [Iterator.Element: Bool] = [:]
|
|
return self.filter { seen.updateValue(true, forKey: $0) == nil }
|
|
}
|
|
}
|