Skip to content

Instantly share code, notes, and snippets.

@kaaaaai
Created November 4, 2021 07:30
Show Gist options
  • Save kaaaaai/b4b6c36e9c2177511999431c4b1e5a74 to your computer and use it in GitHub Desktop.
Save kaaaaai/b4b6c36e9c2177511999431c4b1e5a74 to your computer and use it in GitHub Desktop.
swift.extension.数组去重
extension Sequence where Element: Hashable {
func uniqued() -> [Element] {
var set = Set<Element>()
return filter { set.insert($0).inserted }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment