Skip to main content

How to Start Feed with Specific Post IDs

Introduction

Starting the feed from a specific post improves content discovery, especially when users land via shared links or post thumbnails. This guide shows how to use the LikeMinds Feed iOS SDK to launch a feed that begins from a defined list of post IDs—ideal for video feed experiences.

Prerequisites

Before you begin, ensure the following:

  • LikeMinds Feed iOS SDK: The SDK must be properly installed and initialized in your iOS project. Refer to the installation guide if needed.
  • Basic Understanding of iOS: Familiarity with UIKit and navigation principles.
  • Post ID(s): You must have the specific post IDs you want to start the feed with.

Steps

Step 1: Initialize Feed with Post IDs

Use the LMFeedVideoFeedViewModel to create a module with specific post IDs. This defines the post(s) from which the feed will start.

// Create a video feed screen with specific post IDs
let postIds = ["POST_ID_1", "POST_ID_2"] // Array of post IDs
let videoFeedScreen = try LMFeedVideoFeedViewModel.createModule(postIds: postIds)

Step 2: Present the Feed Screen

Present the feed screen using a navigation controller:

// Create and present the navigation controller
let navigation = UINavigationController(rootViewController: videoFeedScreen)
navigation.modalPresentationStyle = .overFullScreen
present(navigation, animated: true)

Complete Example

Here's a complete example showing how to initialize and present a feed with specific post IDs:

func showFeedWithPostIds(postIds: [String]) {
do {
// Initialize the feed with post IDs
let videoFeedScreen = try LMFeedVideoFeedViewModel.createModule(postIds: postIds)

// Create and present the navigation controller
let navigation = UINavigationController(rootViewController: videoFeedScreen)
navigation.modalPresentationStyle = .overFullScreen
present(navigation, animated: true)
} catch {
print("Error creating feed screen: \(error.localizedDescription)")
}
}

You can pass one or multiple post IDs depending on your requirement. The feed will start from the first post in the list and flow naturally afterward.

info

The LMFeedVideoFeedViewModel handles the initialization of the feed screen and manages the post IDs internally. The feed will automatically start from the specified post IDs when presented.

note

Make sure to handle any potential errors that may occur during the initialization of the feed screen. The createModule method can throw errors if the feed is not properly initialized.