Array append no funciona en Swift

Tengo esta function, pero cuando ejecuto:

theRecipes.append(theRecipe); 

… el tamaño de la matriz 'theRecipes' es exactamente el mismo. Te comparto el código para que puedas ver lo que estoy tratando de hacer en Swift Language.

 func retrieveAll() -> [Recipe] { var query = PFQuery(className: RECIPE_PARSE_CLASSNAME); var theRecipes: [Recipe] = [Recipe](); query.findObjectsInBackgroundWithBlock {(objects: [AnyObject]!, error: NSError!) -> Void in if (error == nil) { // The find succeeded. println("Successfully retrieved \(objects.count) recipes."); // Do something with the found objects if let recipes = objects as? [PFObject] { for recipe in recipes { let theRecipe: Recipe = Recipe(); theRecipe.name = recipe[RECIPE_PARSE_NAME_NAME] as String; theRecipe.about = recipe[RECIPE_PARSE_ABOUT_NAME] as String; theRecipe.cover = recipe[RECIPE_PARSE_COVER_NAME] as String; theRecipe.preview = recipe[RECIPE_PARSE_PREVIEW_NAME] as String; println(theRecipe.name); theRecipes.append(theRecipe); } } } else { // Log details of the failure println("Error: \(error) \(error.userInfo!)"); Bugsnag.notify(nil, withData: ["data": error.description]); } }; return theRecipes; } 

Lo que trato de hacer es reunir cada PFObject para traducirlo a mi propia class de Modelo y para manejarlo de esa manera en la memory. Entonces lo traduzco y lo agrego a la matriz para entregarlo cumplido con recetas.

Quiero aclarar que ya comprobé que estoy recuperando todos los objects de Parse y que no son nulos.

Esta fue mi solución:

 func retrieveAll(returner: (Array<Recipe>) -> Void) { var query = PFQuery(className: RECIPE_PARSE_CLASSNAME); var theRecipes: Array<Recipe> = Array<Recipe>(); query.findObjectsInBackgroundWithBlock {(objects: [AnyObject]!, error: NSError!) -> Void in if (error == nil) { // The find succeeded. println("Successfully retrieved \(objects.count) recipes."); // Do something with the found objects if let recipes = objects as? [PFObject] { for recipe in recipes { let theRecipe: Recipe = Recipe(); theRecipe.name = recipe[RECIPE_PARSE_NAME_NAME] as String; theRecipe.about = recipe[RECIPE_PARSE_ABOUT_NAME] as String; theRecipe.cover = recipe[RECIPE_PARSE_COVER_NAME] as String; theRecipe.preview = recipe[RECIPE_PARSE_PREVIEW_NAME] as String; println(theRecipe.name); theRecipes.append(theRecipe); } returner(theRecipes); } else { println(); returner(Array<Recipe>()); } } else { // Log details of the failure println("Error: \(error) \(error.userInfo!)"); Bugsnag.notify(nil, withData: ["data": error.description]); returner(Array<Recipe>()); } }; } 

Usar un método returner para entregar mis recetas asignadas de forma asíncrona.