ViSearchViewControllerDelegate

public protocol ViSearchViewControllerDelegate: class

delegate for all search controllers. All methods are optional

  • configure the collectionview cell before displaying

    Default Implementation

    Declaration

    Swift

    func configureCell(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath , cell: UICollectionViewCell)
  • configureLayout(sender:layout:) Default implementation

    configure the layout if necessary

    Default Implementation

    Declaration

    Swift

    func configureLayout(sender: AnyObject, layout: UICollectionViewFlowLayout)
  • product selection notification i.e. user tap on a product card

    Default Implementation

    Declaration

    Swift

    func didSelectProduct(sender: AnyObject, collectionView: UICollectionView, indexPath: IndexPath, product: ViProduct)
  • action 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)
  • allow 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)
  • user 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)
  • allow configuration of the filter controller before showing

    Default Implementation

    Declaration

    Swift

    func willShowFilterController(sender: AnyObject, controller: ViFilterViewController)
  • Successful 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

  • Search 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

  • Callback 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