Skip to main content

Post List View

Overview

LikeMindsFeed offers various Post List Screen implementations to cater to different use cases. These screens are responsible for displaying a list of posts in a feed, with each variant optimized for specific content types or interactions.

LMFeedPostListScreen

Functionality

Protocols

LMFeedPostListVCFromProtocol

Defines methods that are triggered from Post List Screens and handled by the parent view controller conforming to it.

  • tableViewScrolled(_ scrollView: UIScrollView): Gives a callback to the parent view controller that the post list view has been scrolled.
  • postDataFetched(isEmpty: Bool): Gives a callback to parent view controller that data has been fetched.

LMFeedPostListVCToProtocol

Defines methods that are triggered from the parent view controller and handled by Post List Screens.

  • loadPostsWithTopics(_ topics: [String]): Tells the Post List Screen to fetch data with the selected topic ids.

Protocols Implemented

UI Components

  • postList: A LMTableView that displays the list of posts.
  • refreshControl: A UIRefreshControl for allowing the user to pull-to-refresh the feed.
  • emptyListView: A LMFeedNoPostWidget that is displayed when there are no posts in the feed.

Methods

  • configureTableViewCells(_ tableView: LMTableView): Registers cell types for the table view.
  • didTapPost(postID: String): Handles navigation to post detail view. Navigates to LMFeedPostDetailScreen
  • didTapCommentButton(for postID: String): Handles opening the comment section for a post. Navigates to LMFeedPostDetailScreen

Cells Registered

Customisations

CustomPostListScreen.swift
class CustomPostListScreen: LMFeedPostListScreen {
override func setupAppearance() {
super.setupAppearance()

tableView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.feedListScreen = CustomPostListScreen.self
// ...
return true
}