Cart View

Last Updated - Platform 19.0 - SDK 14.0

The CartView is the main view of a CartViewController to present the cart items, totals and checkout button. It also presents the loading, empty, and error states.

Container.shared.views.cartView = {

The PoqCartView (default) variation of this view:

  • Uses and passes CartViewData to subviews.
  • Presents a tableView of cart items using a CartViewDataSource.
  • Supports Skeletonable whilst loading; where the data source is responsible for skeleton cells.
  • Presents the CartCheckoutPanelView view to present the total and checkout button.
  • Presents an EmptyView when there are no items with a CTA to begin shopping.
  • Presents an ErrorView when fetching the Cart fails.
  • Uses a TransitioningContainerView to transition with a fade between default (or loading), error and empty states.

Cart View
Cart View

Data Source

The CartViewDataSource for a PoqCartView to present the cart items. This data source:

  • Uses an array of CartContentBlock passed from CartViewData.
  • Presents CartItemView cells for CartContentBlock.
  • Supports Skeletonable and presents skeletonised CartItemView cells whilst loading.
  • Supports Move to Wishlist which is enabled by default but can be disabled by the initialiser.
Container.shared.dataSources.cartViewDataSource = {
shouldShowMoveToWishlistAction: false // Optional, defaults to true.

View Data Mapper

The CartViewDataMapper to map from the CartDomainModel to the CartViewData to present.

Container.shared.mappers.cartViewDataMapper = {