I am trying to define an array of Rxswift Variable which is of different types (Int, String, Bool, String?, etc...)
So technically I want something like this,
var intVariable = Variable<Int>(10)
var stringVariable = Variable<String>("Hello, RxSwift")
let genericArray = [intVariable, stringVariable]
Reason for this is that, I have a list of variables that i want to subscribe on.
However, i can subscribe on the variables individually like intVariable.asObservable().subscribe
, stringVariable.asObservable().subscribe
and so on.
But if its in an array, I could loop through all the elements and subscribe on it.
The Rxswift Variable is defined as public final class Variable<Element>
P.S I have tried type erasure but no luck. Any help on this would be appreciated!