# Catalog

{% tabs %}
{% tab title="iOS" %}

```swift
let query = CatalogQuery()
Traveler.fetchCatalog(query: query) { (catalog, error) in 

}
```

Alternatively you can use the delegate pattern

```swift
Traveler.fetchCatalog(query: query, delegate: self)
```

```swift
extension MyViewController: CatalogFetchDelegate {
    func catalogFetchDidSucceedWith(_ result: Catalog) {
    
    }
    
    func catalogFetchDidFailWith(_ error: Error) {
    
    }
}
```

The UI SDK ships with a view controller which you can use (and/or subclass) to display the catalog. If you wish you can also use them via storyboards, just remember to pass along the `Catalog` instance.

```swift
let catalogResultVC = CatalogResultViewController()
catalogResultVC.catalog = catalog
present(catalogResultVC, animated: true)
```

Should you require further customization, the UI SDK ships with a `CatalogView` that provides the basics of displaying two dimensional data.
{% endtab %}

{% tab title="Android" %}

```java
CatalogQuery query = new CatalogQuery();
Traveler.fetchCatalog(query, new CatalogSearchCallback() {
    @Override
    public void onCatalogSearchSuccess(Catalog catalog) {
    
    }
    
    @Override
    public void onCatalogSearchError(Error error) {
    
    }
});
```

The UI SDK ships with a fragment to handle the display of the fetched Catalog. To include this fragment add a `<FrameLayout>` to your Activity's layout XML:

```markup
    <FrameLayout
            android:id="@+id/catalogContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
```

And in your Activity's `onCreate()` the `CatalogFragment`

```java
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        
    CatalogFragment catalogFragment = CatalogFragment.newInstance(catalog);
        
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.catalogContainer, catalogFragment);
    
    transaction.commit();    
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.guestlogix.io/traveler/mobile-sdks/stripe-payment-sdk/catalog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
