Amr Eladawy
Amr Eladawy

Reputation: 4358

RxSwift - Arrays merge, sort, remove duplicates

Consider the following arrays



let a = [1,2,3,4,5,6]
let b = [5,6,7,8,9]


How to get c, where c = [1,2,3,4,5,6,7,8,9]? In RxSwift, how to do merge, sort, and removing duplicate for the input arrays?

Upvotes: 1

Views: 806

Answers (1)

Code Different
Code Different

Reputation: 93151

Everything you need is provided by the Core Library:

let c = Set(a + b).sorted()

Upvotes: 5

Related Questions