5

I have this code however, I'm not receiving the data in the second view controller... What am I doing wrong here?

        let storyboard = UIStoryboard(name: "PostSubmit", bundle: nil)
        let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController {
            let nc = UINavigationController(rootViewController: vc)
            vc.filteredResult = filteredResult
        }
        self.present(nc, animated: false, completion: nil)
Denis
  • 570
  • 9
  • 23

1 Answers1

3

May be the problem is you are presenting wrong controller nc value you have set is inside the block and it is not available out side that block.

 let vc = storyboard.instantiateViewController(withIdentifier: "PostSubmitVC") as! PostSubmitViewController 
 let nc = UINavigationController(rootViewController: vc)
 vc.filteredResult = filteredResult 
 self.present(nc, animated: false, completion: nil)
Nirav D
  • 71,513
  • 12
  • 161
  • 183
  • Yeah it is man, thank you for all of your help!! I really appreciate it. Seems like its always something so small that I over look. I literally tore apart my code today for something so small. lol – Denis Mar 09 '17 at 08:46
  • @Denis Welcome mate :) – Nirav D Mar 09 '17 at 08:46
  • My bad dude, I was trying to post this question. http://stackoverflow.com/questions/42607702/line-chart-in-swift-3 but thanks for the reminder. Any help on this would be awesome. Its from another source online, but I had trouble converting it to swift 3 – Denis Mar 09 '17 at 08:49
  • @Denis You want help with that question? – Nirav D Mar 09 '17 at 08:50
  • Yeah if you could. – Denis Mar 09 '17 at 08:55
  • @Denis let me check If possible will give solution. – Nirav D Mar 09 '17 at 08:59