How to Access Objects from one ViewController to another ViewController

前端 未结 3 1244
故里飘歌
故里飘歌 2021-02-11 00:57

Provide some tips to get rid of the following scenario.

Description:

I have two viewControllers namely ViewController1 and ViewController2, so

3条回答
  •  时光说笑
    2021-02-11 01:08

    You can use a model object that contains the two strings and that is known by both controllers.

    If you want each controller to be notified whenever the other update the value of the strings, you can use notification mechanism. This allows your model to let other objects know about its changes and stay independant from these objects.

提交回复
热议问题