Store int and call it in another file

This is my code:

var art: Int = 0
@IBAction func art(_ sender: Any) {
        art += 1
        tutText = "artTut"
        if art == 1{
            let storyBoard: UIStoryboard = UIStoryboard(name: "Art", bundle: nil)
            let newViewController = storyBoard.instantiateViewController(withIdentifier: "UITabBarController") as! NewViewController
            self.present(newViewController, animated: true, completion: nil)

The log printed ‘1’. But when I proceed to NewViewController, the log printed ‘0’ See the code in NewViewController.:

let main = PreviousViewController()

Do you have solution so that it printed ‘1’ in NewViewController

Powered by WPeMatico

You may also like...

Comments are closed.