Inherits from RVMViewModel : NSObject
Declared in MMRestaurantViewModel.h
MMRestaurantViewModel.m

Overview

  • The View Model for MMRestaurantViewController. Responsible

  • for providing the data for the view controller.

*

  • See anlax.com/blog/model-view-viewmodel-for-ios/ for more

  • information on the ModelView-View-Model (MVVM) architecture

  • pattern.

Properties

controllerShouldReloadDataSource

  • Notifies the corresponding conroller that the data source
@property (nonatomic, strong) RACSubject *controllerShouldReloadDataSource

Discussion

  • has been updated.

Declared In

MMRestaurantViewModel.h

controllerShouldShowProgressIndicator

  • Notifies the corresponding controller to hide/show a progress
@property (nonatomic, strong) RACSubject *controllerShouldShowProgressIndicator

Discussion

  • indicator based on whether or not data is currently being

  • retrieved from the network.

Declared In

MMRestaurantViewModel.h

dataSourceType

  • Represents the type of objects that are
@property (nonatomic) NSInteger dataSourceType

Discussion

  • currently in the data source.

*

  • @see MMMenuItemDataSource and MMReviewsDataSource

Declared In

MMRestaurantViewModel.h

merchantInformation

  • The MMMerchant model that this view model represents.
@property (nonatomic, strong) MMMerchant *merchantInformation

Declared In

MMRestaurantViewModel.h

reviewOrder

  • Represents which orderering the reviews
@property (nonatomic) NSInteger reviewOrder

Discussion

  • should be organized by.

*

  • @see MMOrderByRecent and MMOrderByTopRated

Declared In

MMRestaurantViewModel.h

reviewTabIndex

  • Represents the index that corresponds to the
@property (nonatomic, readonly, getter=getReviewTabIndex) NSNumber *reviewTabIndex

Discussion

  • review tab. This evaluates to the number of

  • categories a restaurant has + 1.

Declared In

MMRestaurantViewModel.h

selectedTabIndex

  • Represents the currently selected tab in the
@property (nonatomic) NSInteger selectedTabIndex

Discussion

  • view.

Declared In

MMRestaurantViewModel.h

Instance Methods

getAllMenuItems

  • Retrieves an NSMutableArray of all
- (RACSignal *)getAllMenuItems

Discussion

  • the menu items for the currently

  • represented restaurant.

*

  • @return A NSMutableArray of all the

  •    menu items for the current
    
  •    merchant.
    

Declared In

MMRestaurantViewModel.h

getItemFromCurrentDataSourceForIndexPath:

  • Returns the object that at the specified
- (id)getItemFromCurrentDataSourceForIndexPath:(NSIndexPath *)indexPath

Discussion

  • index in the current data source.

*

  • @param indexPath Position of object in data source.

*

  • @return The object at the specified position in data

  •    source.
    

Declared In

MMRestaurantViewModel.h

getTabCategories

  • Retrieves an NSArray of strings that will
- (RACSignal *)getTabCategories

Discussion

  • represent the tab names in the category

  • segmented control.

*

  • @return A signal containing an NSArray of

  •    category names.
    

Declared In

MMRestaurantViewModel.h

numberOfItemsInCurrentDataSource

  • Returns the number of items in the
- (NSInteger)numberOfItemsInCurrentDataSource

Discussion

  • data source.

*

  • @return The number of items in the

  •    current data source.
    

Declared In

MMRestaurantViewModel.h

searchForItemWithValue:

  • Searchs for a value in the current data sources and
- (void)searchForItemWithValue:(NSString *)valueToSearchFor

Discussion

  • updates public data source to reflect the values

  • found. Currently, this method only works when the

  • data source has MMMenuItem object in it. The

  • search is performed against the name property

  • of the MenuItem.

*

  • @param valueToSearchFor The value of the name to search

  •                    for.
    

Declared In

MMRestaurantViewModel.h