Nuwe Core iOS SDK - NUNutritionManager Class


#1

This POST is a work in progress

The NUNutritionManager class contains numerous features suitable for interacting the the Nutrition Features on the NUWE REST API.

Most of these features have been created in service to our own nutrition tracking demo app, Nutribu.

Ingredients Groups

- (void)loadIngredientGroupWithBlock:(NUStringResultBlock) block;

This method will grab all of the Ingredients Groups and child Ingredients in the NUWE Simple Ingredients API and cache it in our shared Data store locally.

An example of this method working can be seen in our own Nutribu app, whereby we fetch all the Simple Ingredients and group them by Ingredient Group for the user to select from when building meals or logging Eats.

Meals

- (void)previewMealWithBlock:(NUMealPreviewResultBlock)block;

A meal preview enables you to get a

- (void)saveMeal:(NSString*)szName andImage:(UIImage*)image andFavorite:(BOOL)fFavorite andMealTypeId:(NSArray*)afMealType andLat:(double)lat andLon:(double)lon forPlaces:(NSArray*)places withBlock:(NUMealResultBlock) block;

To create a NUMeal object, you can call this method, passing the various arguments as parameters to

- (void)showMeal:(NSString*)szId withBlock:(NUMealResultBlock) block;
- (void)getMyMeals:(int)page withBlock:(NUArrayListResultBlock) block;

- (void)getAllMeals:(int)page withBlock:(NUArrayListResultBlock) block;

- (void)destoryMyMeal:(NSString*)szId withBlock:(NUStringResultBlock) block;

Favourites

- (void)getAllMyFavouritesWithBlock:(NUArrayListResultBlock) block;
- (void)markFavoriteMeal:(NSString*)szId withBlock:(NUStringResultBlock) block;
- (void)destoryFavoriteMeal:(NSString*)szId withBlock:(NUStringResultBlock) block;

Eats Tracking

- (void)eatMeal:(NSArray*)aId withBlock:(NUStringResultBlock) block;
- (void)eatIngredientsWithBlock:(NUStringResultBlock) block;
- (void)eatIngredientsWithParam:(NSDictionary*)dicParam withBlock:(NUStringResultBlock) block;
- (void)getAllEats:(BOOL) isForTodayOnly withBlock:(NUArrayListResultBlock) block;
- (void)destoryEat:(NSString*)szId withBlock:(NUStringResultBlock) block;

Nutrition Reports

- (void)getAllMyNutritionHistoryWithBlock:(NUArrayListResultBlock) block;
- (void)getTodayNutritionScoreWithBlock:(NUNutritionScorePointResultBlock)block;