SHARE
TWEET

Untitled

a guest Dec 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. extension JX_TypeWrapper where T: RangeReplaceableCollection, T.Element: Equatable {
  2.   mutating func remove(object: T.Element) {
  3.     if let index = SELF.firstIndex(of: object) {
  4.       SELF.remove(at: index)
  5.     }
  6.   }
  7. }
  8.    
  9. var array: [Int] = [1, 2, 3]
  10. var wrapped = JX_TypeWrapper(value: array)
  11. wrapped.remove(object: 2)
  12. wrapped.SELF // [1, 3]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top