> For the complete documentation index, see [llms.txt](https://docs.firework.com/firework-for-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.firework.com/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/customization-ios/video-feed-layouts-ios.md).

# Video feed layouts (iOS)

### Horizontal layout

By default, the video feed adopts a horizontal layout. You can use the following code to customize configurations, such as item ratio, for this layout. As demonstrated in the code below, you set the `itemWidthRatio` to 16:9 to render the video item in a horizontal layout.

```swift
let layout = VideoFeedHorizontalLayout()
// Configure itemWidth:itemHeight to 16:9
layout.itemWidthRatio = 16 / 9
// Configure spacing between items
layout.itemSpacing = 10
// Configure content insets
layout.contentInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)

let channelID = "<Encoded Channel ID>"
let playlistID = "<Encoded Playlist ID>"

// Create VideoFeedViewController instance
let feedVC = VideoFeedViewController(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)

// Create VideoFeedView instance
let feedView = VideoFeedView(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)

VideoFeedSwiftUIView(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)
```

<div align="center" data-full-width="false"><figure><img src="/files/U7DQlQVEyjJ2pzC8UJ8Z" alt="" width="375"><figcaption><p>Vertical item width ratio (such as 4 / 6)</p></figcaption></figure></div>

<div align="center"><figure><img src="/files/W4ZZMNMwDn6a2d5gxTOh" alt="" width="375"><figcaption><p>Horizontal item width ratio (such as 16 / 9)</p></figcaption></figure></div>

### Grid layout

You can implement a grid layout using VideoFeedGridLayout. The following code allows you to customize configurations, such as the item ratio.

```swift
let layout = VideoFeedGridLayout()
// Configure itemWidth:itemHeight to 4:6
layout.itemWidthRatio = 4 / 6
// Configure number of columns
layout.numberOfColumns = 2
// Configure spacing between items
layout.itemSpacing = 10
// Configure content insets
layout.contentInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)

let channelID = "<Encoded Channel ID>"
let playlistID = "<Encoded Playlist ID>"

// Create VideoFeedViewController instance
let feedVC = VideoFeedViewController(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)

// Create VideoFeedView instance
let feedView = VideoFeedView(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)

VideoFeedSwiftUIView(
    layout: layout,
    source: .channelPlaylist(
        channelID: channelID,
        playlistID: playlistID
    )
)
```

<figure><img src="/files/dvsNsgdBGpCTpUEzjnRo" alt="" width="375"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.firework.com/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/customization-ios/video-feed-layouts-ios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
