0

I have trouble in my application with swift 4. I'd like to move my view controller automatically when my string get a value without nil. (Promatically)

However it does not work at all.

if(rst_str != nil){
    let nextView = storyboard?.instantiateViewController(withIdentifier: "viewListController") as! ViewListController

    //viewListController.delegate = self;

    print("log storyboard");

    self.present(nextView, animated: true, completion: nil);
}

The message of "log storyboard" is printed normally. However the line of self.present is not working at all.

How can I resolve from my issue?

Richard
  • 351
  • 4
  • 17

1 Answers1

2

The line

 self.present(nextView, animated: true, completion: nil);

won't work in 2 cases

1- the current vc you run this line in is currently not fully laid - out such as making it in viewDidLoad

2- the current vc is currently presenting another vc

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87