Video Feed Layouts

There are two concrete layout types VideoFeedHorizontalLayout and VideoFeedGridLayout. A layout can be specified at time of instantiating a let feedVC = VideoFeedViewController(layout: VideoFeedGridLayout()). Or the layout can be set later by setting the layout property of the video feed view controller; feedVC.layout = VideoFeedHorizontalLayout().

Horizontal Layout

The VideoFeedHorizontalLayout is a layout that has a single row and scrolls horizontally. The row will fill the available height.

A VideoFeedHorizontalLayout is best used by embedding in another view controller.

Grid Layout

The VideoFeedGridLayout is a layout that provides a vertical scrolling feed that has both columns and rows. The width of the items in the grid are calculated based on the numberOfColumns property in the VideoFeedGridLayout.

Vertical Layout

A vertical layout can be achieved by setting numberOfColumns property in the VideoFeedGridLayout as 1.

Note: Only changing a layout property does not change the VideoFeedViewController layout. To update the VideoFeedViewController layout you must set the layout property after making the layout changes.

Last updated