Video Feed View Configurations

There are many view customizations that are exposed and can be accessed by the viewConfiguration of a VideoFeedViewController. All view configurations are value types which means changing the properties will not update the view state. To update the view state, simply set the viewConfiguration with the updated view configuration.

let feedVC = VideoFeedViewController()

// Gets the default configuration
var config = feedVC.viewConfiguration

// Sets the feed  background to white
config.backgroundColor = .white

// Gets the feed item view configuration. This applies to all items in the feed.
var itemConfig = config.itemView

// Sets the corner radius to 4
itemConfig.cornerRadius = 4
// Sets the title layout insets to 0
itemConfig.titleLayoutConfiguration.insets = .zero
// Sets the title position to stacked
itemConfig.titleLayoutConfiguration.titlePosition = .stacked
// Sets the title to System 18
itemConfig.title.font = .systemFont(ofSize: 18)
// Sets the title number of lines to 1
itemConfig.title.numberOfLines = 1
// Sets the title color to black
itemConfig.title.textColor = .black
// Sets the title is hidden to false
itemConfig.title.isHidden = false
// Specifies if the sposored label should be shown on thumbnails
itemConfig.sponsored.isHidden = false
// Specifies if autoplay is enabled on thumbnails. 
itemConfig.autoplay.isEnabled = true

// Updates the title configuration
config.itemView = itemConfig

// Must set the viewConfiguration property to apply the changes
feedVC.viewConfiguration = config

Last updated