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({$0.name < $1.name})
Any pointers will be appreciated!
here my solution
Observable
.just(items)
.map({ (items) -> [AnyObject] in
return items.sorted(by: { (item1, item2) -> Bool in
return item1.name < item2.name
})
})
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With