ViSearchViewControllerDelegate
public protocol ViSearchViewControllerDelegate: class
delegate for all search controllers. All methods are optional
-
configureCell(sender:collectionView:indexPath:cell:)
Default implementationconfigure the collectionview cell before displaying
Default Implementation
Declaration
Swift
func configureCell(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath , cell: UICollectionViewCell)
-
configureLayout(sender:layout:)
Default implementationconfigure the layout if necessary
Default Implementation
Declaration
Swift
func configureLayout(sender: AnyObject, layout: UICollectionViewFlowLayout)
-
didSelectProduct(sender:collectionView:indexPath:product:)
Default implementationproduct selection notification i.e. user tap on a product card
Default Implementation
Declaration
Swift
func didSelectProduct(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath, product: ViProduct)
-
actionBtnTapped(sender:collectionView:indexPath:product:)
Default implementationaction button tapped notification i.e. user tap on action button at the top right corner of a product card cell
Default Implementation
Declaration
Swift
func actionBtnTapped(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath, product: ViProduct)
-
willShowSimilarController(sender:controller:collectionView:indexPath:product:)
Default implementationallow configuration of the FindSimilar controller when similar button is tapped This is triggered before the similar controller is pushed to navigation controller/shown in modal
Default Implementation
Declaration
Swift
func willShowSimilarController(sender: AnyObject, controller: ViFindSimilarViewController, collectionView: UICollectionView, indexPath: IndexPath, product: ViProduct)
-
similarBtnTapped(sender:collectionView:indexPath:product:)
Default implementationuser tapped on similar button at the bottom right of a product card cell
Default Implementation
Declaration
Swift
func similarBtnTapped(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath, product: ViProduct)
-
willShowFilterController(sender:controller:)
Default implementationallow configuration of the filter controller before showing
Default Implementation
Declaration
Swift
func willShowFilterController(sender: AnyObject, controller: ViFilterViewController)
-
searchSuccess(sender:searchType:reqId:products:)
Default implementationSuccessful search after refreshData() method is called
- Parameters:
- sender: the controller that generate this search request
- searchType: the recent search type
- reqId: recent request id
- products: list of extract products information based on mapping
Default Implementation
Declaration
Swift
func searchSuccess( sender: AnyObject, searchType: ViSearchType, reqId: String? , products: [ViProduct])
Parameters
sender
the controller that generate this search request
searchType
the recent search type
reqId
recent request id
products
list of extract products information based on mapping
- Parameters:
-
searchFailed(sender:searchType:err:apiErrors:)
Default implementationSearch failed callback
- Parameters:
- sender: the controller that generate this search request
- searchType: the recent search type
- err: Errors when trying to call the API e.g. network related errors like offline Internet connection
- apiErrors: errors returned to ViSenze server e.g. due to invalid/missing search parameters
Default Implementation
Declaration
Swift
func searchFailed(sender: AnyObject, searchType: ViSearchType, err: Error?, apiErrors: [String])
Parameters
sender
the controller that generate this search request
searchType
the recent search type
err
Errors when trying to call the API e.g. network related errors like offline Internet connection
apiErrors
errors returned to ViSenze server e.g. due to invalid/missing search parameters
- Parameters:
-
controllerWillTransition(controller:to:with:)
Default implementationCallback for rotation. Trigger when viewWillTransition is called
- Parameters:
- size: size after rotation
- coordinator: coordinator
Default Implementation
Declaration
Swift
func controllerWillTransition(controller: UIViewController , to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
Parameters
size
size after rotation
coordinator
coordinator
- Parameters: