Post List View
Overview
LMFeedPostListScreen
is used to displays a list of posts in a feed.
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 theLMFeedPostListScreen
to fetch data with the selected topic ids.
Protocols Implemented
- LMFeedPostHeaderViewProtocol
- LMFeedPostFooterViewProtocol
- LMPostWidgetTableViewCellProtocol
- LMFeedLinkProtocol
- LMFeedPostDocumentCellProtocol
UI Components
postList
: ALMTableView
that displays the list of posts.refreshControl
: AUIRefreshControl
for allowing the user to pull-to-refresh the feed.emptyListView
: ALMFeedNoPostWidget
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
}