Created
February 21, 2015 17:57
-
-
Save anzfactory/4b1bbaaeab42e93726fa to your computer and use it in GitHub Desktop.
SwiftでObjective-Cの[NSarray removeObject:]てきなやつをする
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 { | |
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