Skip to main content

Post List View

Overview

LMFeedPostListScreen is used to displays a list of posts in a feed.

LMFeedPostListScreen

Protocols

LMFeedPostListVCFromProtocol

Defines methods that are triggered from LMFeedPostListScreen 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 LMFeedPostListScreen.

  • loadPostsWithTopics(_ topics: [String]): Tells the LMFeedPostListScreen 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

  • pullToRefresh(): Handles the pull-to-refresh action of tableview by fetching the initial page of the feed.

Customisation

CustomTopicSelectionScreen.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
}