I have one View and two classes (Cls1 and Cls2).
Object of Class1 initialised in view like:
@ObservedObject var cls1 = Cls1()
And I have no problems to get variables of clsObj declaring them inside class as:
@Published var myVarFromCls1 = false
However, I have Cls2, it was initialised inside Cls1:
var cls2 = Cls2()
and I need to get changes in variables of cls2 inside my view.
I've tried to redeclare cls2 initialization to:
@Published var cls2 = Cls2()
But I can't get its variable in view using:
@ObservedObject var cls1 = Cls1()
$cls1.cls2.myVarFromCls2
declared in Class2:
@Published var myVarFromCls2 = false
How to do it right way?