goodsamaritan goodsamaritan - 1 year ago 585
Swift Question

RxSwift Observable Array Sorting

I am trying to sort an observable array and havent had any luck (RxSwift n00b)

let items = [AnyObject]?
let locations = Observable.just(items)

I want to achieve something like this on locations

items.sortInPlace({$ < $})

Any pointers will be appreciated!

Answer Source

I figured

  1. initing locations as Variable([AnyObject]())
  2. setting locations asObservable
  3. sorting as locations.value.sortInPlace({$ < $})

Feels good!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download