Booking Item Search UI
Last updated
Was this helpful?
Last updated
Was this helpful?
There is a complete flow in the UI layer of our SDK that deals with search. Like all of our flows it is designed using the Model-View-Controller architecture. To combat the problem of massive view controllers, this implementation makes heavy use of state machines and delegation.
An image of the search storyboard can be found below. The flow of information is color coded with blue arrows being information transmitted through segues and green arrows being information transmitted through delegates
The main responsibility of this view controller is to receive the text input from the user and execute a query from that text.
While the search is being execute it performs a segue to the loading screen so a loading spinner renders
In the delegate methods for search, if the error function executes then this view controller will trigger a segue to the RetryViewController
. If the success function executes then the controller will trigger a segue to the BookingItemSearchResultViewController
When executing a segue to the BookingItemSearchResultViewController
, this controller will pass the search query and the search results in the prepare(for segue: UIStoryboardSegue, sender: Any?)
method.
This view controller also conforms to the RetryViewControllerDelegate
protocol which has a function that executes when the retry button is pressed. Should this function execute, then this view controller will make the search call again.
The main responsibility of this view controller is to display the paginated results of a text search into a collection view.
This view controller displays an error message and a retry button that will trigger a delegate function to inform its parent view controller that a retry was requested.
This is the first view controller in the storyboard and it is the entry view controller. This controller performs as a state machine. The complete source code for this view controller can be found .
This view controller instantiates a and conforms to the protocol to handle search inputs
Once the search is executed, this controller executes a search by calling the method.
This view controller displays the items contained in the the complete source code for this view controller can be found .
Whenever the user taps into one of the items, this view controller will trigger a segue to a flow that will display the details of that particular item. That flow is represented as a storyboard reference in the diagram above.