Skip to content

Instantly share code, notes, and snippets.

@Briahas
Created June 4, 2018 14:34
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/82d7bfcaca12b34e932f8b939d968ba8 to your computer and use it in GitHub Desktop.
Save Briahas/82d7bfcaca12b34e932f8b939d968ba8 to your computer and use it in GitHub Desktop.
extension Array where Element: Equatable {
mutating func delete(_ element: Element) {
self = self.filter { $0 != element }
}
mutating func removeObject<T>(_ element: T) where T : Equatable {
self = self.filter {$0 as? T != element}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment