MMRestaurantViewModel Class Reference
Inherits from | RVMViewModel : NSObject |
Declared in | MMRestaurantViewModel.h MMRestaurantViewModel.m |
Overview
The View Model for
MMRestaurantViewController
. Responsiblefor providing the data for the view controller.
*
See
anlax.com/blog/model-view-viewmodel-for-ios/
for moreinformation on the ModelView-View-Model (MVVM) architecture
pattern.
Tasks
-
merchantInformation
property -
controllerShouldShowProgressIndicator
property -
controllerShouldReloadDataSource
property -
selectedTabIndex
property -
reviewOrder
property -
dataSourceType
property -
reviewTabIndex
property -
– getTabCategories
-
– getAllMenuItems
-
– numberOfItemsInCurrentDataSource
-
– getItemFromCurrentDataSourceForIndexPath:
-
– searchForItemWithValue:
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
andMMReviewsDataSource
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
andMMOrderByTopRated
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 themenu 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
ofcategory 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. Thesearch is performed against the
name
propertyof the
MenuItem
.
*
@param valueToSearchFor The value of the
name
to searchfor.
Declared In
MMRestaurantViewModel.h