How to save the data inside the class, I figured out, and how to transfer them to the field of another class? I have for each View Controller my own UIViewController class.
1 answer
Create a global variable in one ViewController:
public var <ваша переменная> class ViewController1: UIViewController { <код контроллера> } And now you can access this variable from another ViewController.
class ViewController2: UIViewController { <ваша переменная> — можете обращаться к ней так } - Thank! Understood, turned out! And how can I save data for an unlimited time? I noticed that after restarting the OS, the data is lost ... - Igor Zexyy
- It is necessary to use a DB, probably. Read about CoreData - danilenkodanila
|
vc1.field = vc2.field;- markov