A
A
arturios5712018-02-06 15:02:21
Swift
arturios571, 2018-02-06 15:02:21

I can’t throw a delegate from the container, how to do it right?

Hello!
There is HomeVC in it 2 containers VC1 VC2. In VC1 there is a button by clicking on a short one, I delegate the task to HomeVC and it delegates to VC2 to change the contents of the container.
example
VC1.delegate = homeVC
homeVC.delegate = VC2 The
problem is that homeVC.delegate drops nil.
But if you take the button from VC1 out of the container and just put it in HomeVC, then everything is OK. I understand that somewhere the initiator does not have time?
If you need I will throw off the whole code!
Here is an example button from the top container does not change anything and also a button from homeVC changes
pP3bmJlFjj.gif

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Protasov, 2018-02-15
@protasov_a

In such cases, it is common for homeVCs to store nested VCs in var. Then in the second case, the delegate is not needed, but from the nested VCs, data or commands are received through the delegate. Most likely you don't have a strong reference to VC2 and its delegate becomes nil.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question