Skip to content

Instantly share code, notes, and snippets.

@codelynx
Last active March 24, 2016 13:14
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 codelynx/39a662f9f76a6749ed2a to your computer and use it in GitHub Desktop.
Save codelynx/39a662f9f76a6749ed2a to your computer and use it in GitHub Desktop.
Extension for Array to remove an object from it.
extension Array where Element: Equatable {
mutating func remove<Element: Equatable>(object: Element) -> Array {
self = self.filter { $0 as? Element != object }
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment