How do I run a query and populate an array before instantiating the pageViewController
<p>I am importing data from Parse and trying to put it into a page view controller. The code for the query is correct, but it is not being called. It tries to add the objects inside the array to the pageviewcontroller, but those arrays are empty, they will only get populated after the query. So how do I make sure the query runs and populates the array first?</p>

<pre><code>override func viewDidLoad() {
    super.viewDidLoad()
    testRetrieveInfo()
}

 func retrieveinfo(callback:([String])-&gt;Void){

     let query = PFQuery(className: "Animals")
        query.findObjectsInBackgroundWithBlock { (objects:[PFObject]?, error: NSError?) in
                if(error == nil){
                    for object in objects!{     
                        if let importname = object["Name"] as? String{
                            self.name = NSArray(object: importname)
                            print(self.name) //Nothing prints, I also breakpoint and it crashes first, crash location is above in viewDidLoad
                        }
                    }

                }else{
                        print(error)
                }
            }
       }
  }

func testRetrieveInfo(){
    self.retrieveInfo { (results:[String]) -&gt; Void in
        //Setup here the PageViewController
        self.pageViewController.storyboard?.instantiateViewControllerWithIdentifier("PageVC") as? UIPageViewController
        self.pageViewController.dataSource = self
        var startVC = self.viewControllerAtIndex(0) as? Jwasy
        var viewControllers = NSArray(object: startVC!)
        self.pageViewController.setViewControllers(viewControllers as? [UIViewController], direction: .Forward , animated: true, completion: nil)
        self.pageViewController.view.frame = CGRectMake(0, 30, self.view.frame.width, self.view.frame.height)
        self.addChildViewController(self.pageViewController)
        self.view.addSubview(self.pageViewController.view)
        self.pageViewController.didMoveToParentViewController(self)
        print("called")//not printed
    }
}
</code></pre>