Skip to content

Instantly share code, notes, and snippets.

@Briahas
Created November 6, 2019 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Briahas/498e630c11b099364d769222f33e9aae to your computer and use it in GitHub Desktop.
Save Briahas/498e630c11b099364d769222f33e9aae to your computer and use it in GitHub Desktop.
extension Array where Element: Hashable {
func difference(from other: [Element]) -> [Element] {
let thisSet = Set(self)
let otherSet = Set(other)
return Array(thisSet.symmetricDifference(otherSet))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment