Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension JX_TypeWrapper where T: RangeReplaceableCollection, T.Element: Equatable {
- mutating func remove(object: T.Element) {
- if let index = SELF.firstIndex(of: object) {
- SELF.remove(at: index)
- }
- }
- }
- var array: [Int] = [1, 2, 3]
- var wrapped = JX_TypeWrapper(value: array)
- wrapped.remove(object: 2)
- wrapped.SELF // [1, 3]
Add Comment
Please, Sign In to add comment