2

How reload viewcontraller like first time in Swift 4? Details: when run app then enter viewcontraller then exit from it and I want back to same viewcontraller I want download viewcontraller from new same first time.

//code close viewcontraller :
self.dismiss(animated: true, completion: {})

//code on enter or back to viewcontraller :
DispatchQueue.main.async {
    self.performSegue(withIdentifier: "sbmpo2", sender: nil)    
}

3 Answers 3

1

Assign data to the ViewController or making API calls inside viewWillAppear that will call everytime when you came to that viewcontroller. Only you have to do to call data population functions/API call inside viewWillAppear

override func viewWillAppear(_: Bool) {
        super.viewWillAppear(true)

        //call your data populating/API calls from here

}

Hope this will help you

Sign up to request clarification or add additional context in comments.

1 Comment

I did that but same problem
1

Take a look at the following methods of UIViewController:

The first two are called each time the view is shown. The last two are called each time the view goes away.

You can override these methods in your ViewController to setup your view as you wish.

1 Comment

I did that but same promblem
0
self.dismiss(animated: true) {

    //UIViewController is dismissed

    DispatchQueue.main.async 
        self.performSegue(withIdentifier: "sbmpo2", sender: nil)
    }
}

Hope this will help you

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.