Last active
March 24, 2016 13:14
-
-
Save codelynx/39a662f9f76a6749ed2a to your computer and use it in GitHub Desktop.
Extension for Array to remove an object from it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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