Customize Views
Each page & template is fully customizable to your brand's design. All View Options are optional, there are Mealz defaults for each view.
info
To understand how to create a custom component, you can read here.
We recommend putting all of your custom ViewOptions into a custom class.
In our sample implementations, we have one class MealzViewConfig, however you may find it more maintainable to have multiple classes.
import MealziOSSDK
import MealzUIiOSSDK
import MealzNaviOSSDK
struct MealzViewConfig {
// the below View Options go here
}
Base Views
View Options
Base Views - BasePageViewParameters
import MealzUIiOSSDK
import MealziOSSDK
static let baseViews = BasePageViewParameters(
loading: TypeSafeLoading(/* your new view*/),
empty: TypeSafeEmpty(/* your new view*/),
background: TypeSafeBackground(/* your new view*/)
)
Protocols:
Favorites Options
View Options
Favorites - FavoritesViewOptions
import MealzUIModuleIOS
import MiamIOSFramework
static let favoritesViewOptions = FavoritesViewOptions(
title: TypeSafeBaseTitle(/* your new view*/),
recipeCard: TypeSafeCatalogRecipeCard(/* your new view*/),
recipeCardLoading: TypeSafeRecipeCardLoading(/* your new view*/)
)
Protocols:
Catalog Recipes List Grid Config
import MealzUIModuleIOS
import MiamIOSFramework
static let recipesListGridConfig = CatalogRecipesListGridConfig(
numberOfColumns: 2,
spacing: CGSize(width: 4, height: 4),
recipeCardDimensions: CGSize(width: 300, height: 180),
recipeCardFillMaxWidth: true // if set to true, the width set above is ignored & it will take all the available space
)
Favorites Feature Constructor
FavoritesFeatureConstructor(
baseViews: favoritesBaseViews, // or you can pass in BaseViews from the Catalog or another Feature
favoritesViewOptions: favoritesViewOptions,
catalogRecipesListGridConfig: favoritesRecipesListGridConfig, // or same as Catalog or another feature
navigateToCatalog: {/* on the standalone Feature, you must implement this */}
)
Recipe Details Options
View Options
Recipe Details - RecipeDetailsViewOptions
import MealzUIModuleIOS
import MiamIOSFramework
static let recipeDetailsViewOptions = RecipeDetailsViewOptions(
header = TypeSafeRecipeDetailsHeader(/* your new view*/),
sponsor = TypeSafeRecipeDetailsSponsor(/* your new view*/),
selectedControl = TypeSafeRecipeDetailsSelectedControl(/* your new view*/),
ingredients = TypeSafeRecipeDetailsIngredients(/* your new view*/),
steps = TypeSafeRecipeDetailsSteps(/* your new view*/),
footer = TypeSafeRecipeDetailsFooter(/* your new view*/),
ingredientsAtHomeToggleButton = TypeSafeBaseButton(/* your new view*/),
unavailableIngredientsToggleButton = TypeSafeBaseButton(/* your new view*/),
ingredientsAtHome = TypeSafeNotInBasketProduct(/* your new view*/),
unavailableIngredients = TypeSafeNotInBasketProduct(/* your new view*/)
)
Protocols:
- RecipeDetailsHeaderProtocol
- RecipeDetailsSponsorProtocol
- RecipeDetailsSelectedControlProtocol
- RecipeDetailsIngredientsProtocol
- RecipeDetailsStepsProtocol
- RecipeDetailsFooterProtocol
- BaseButtonProtocol
- NotInBasketProductProtocol
Products - RecipeDetailsProductViewOptions
import MealzUIModuleIOS
import MiamIOSFramework
static let recipeDetailsProductViewOptions = RecipeDetailsProductViewOptions(
ignoredProduct = TypeSafeRecipeDetailsIgnoredProduct(/* your new view*/),
unaddedProduct = TypeSafeRecipeDetailsUnaddedProduct(/* your new view*/),
addedProduct = TypeSafeRecipeDetailsAddedProduct(/* your new view*/),
loadingProduct = TypeSafeLoading(/* your new view*/)
)
Protocols:
- RecipeDetailsIgnoredProductProtocol
- RecipeDetailsUnaddedProductProtocol
- RecipeDetailsAddedProductProtocol
- LoadingProtocol
Item Selector - ItemSelectorViewOptions
import MealziOSSDK
import MealzUIiOSSDK
static let itemSelectorViewOptions = ItemSelectorViewOptions(
searchBar = TypeSafeSearch(/* your new view*/),
title = TypeSafeBaseTitle(/* your new view*/),
selectedProduct = TypeSafeItemSelectorSelectedProduct(/* your new view*/),
productOptions = TypeSafeItemSelectorOptionProducts(/* your new view*/),
noResults = TypeSafeItemSelectorNoResults(/* your new view*/)
)
Protocols:
- SearchProtocol
- BaseTitleProtocol
- ItemSelectorSelectedProductProtocol
- ItemSelectorOptionProductsProtocol
- ItemSelectorNoResultsProtocol
Recipe Details Constructor
RecipeDetailsFeatureConstructor(
baseViews: recipeDetailsBaseViews, // or you can pass in BaseViews from the Catalog or another Feature
recipeDetailsViewOptions: recipeDetailsViewOptions,
recipeDetailsProductViewOptions: recipeDetailsProductViewOptions,
itemSelectorViewOptions: itemSelectorViewOptions
)
Putting it All Together
- UIKit
- SwiftUI
import MealzNavModuleIOS
public let mealzFavoritesFeature = MealzFavoritesFeatureUIKit(
recipeDetailsConstructor: MealzViewConfig.recipeDetailsConfig,
favoritesFeatureConstructor: MealzViewConfig.favoritesConfig
)
import MealzNavModuleIOS
MealzFavoritesFeatureSwiftUI(
recipeDetailsConstructor: MealzViewConfig.recipeDetailsConfig,
favoritesFeatureConstructor: MealzViewConfig.favoritesConfig)