Skip to content

Instantly share code, notes, and snippets.

@anzfactory
Created February 21, 2015 17:57
Show Gist options
  • Save anzfactory/4b1bbaaeab42e93726fa to your computer and use it in GitHub Desktop.
Save anzfactory/4b1bbaaeab42e93726fa to your computer and use it in GitHub Desktop.
SwiftでObjective-Cの[NSarray removeObject:]てきなやつをする
extension Array {
mutating func removeObject<E: Equatable>(object: E) -> Array {
for var i = 0; i < self.count; i++ {
if self[i] as E == object {
self.removeAtIndex(i)
break
}
}
return self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment