Skip to main content

Universal Feed

Overview

LMUniversalFeedScreen displays a universal feed screen with a topic selection bar and a list of posts, create post button.

LMUniversalFeedScreen

UI Components

  • contentStack: A LMStackView that holds the main content of the view controller.
  • topicContainerView: A LMView that contains topicStackView.
  • topicStackView: A LMStackView that holds the topic selection UI elements.
  • topicSelectionButton: A LMButton that allows the user to navigate to the "All Topics" screen.
  • topicCollection: A LMCollectionView that displays the filtered topics.
  • clearButton: A LMButton that allows the user to clear the filtered topics.
  • postList: An instance of LMFeedPostListScreen that displays the list of posts.
  • createPostButton: A LMButton that allows the user to create a new post.
  • createPostLoaderView: A LMFeedAddMediaPreview view that displays a loading animation during post creation.

Methods

  • postCreationInProgress(notification:): Handles the post creation in progress notification.
  • postCreationSuccessful(): Handles the post creation successful notification.
  • postError(notification:): Handles post creation and edit errors.

Action Handlers

  • didTapAllTopicsButton(): Navigates to the Topic Selection.
  • didTapClearButton(): Clears the selected topics.
  • didTapNewPostButton(): Navigates to the "Create Post" screen.
  • didTapNotificationButton(): Navigates to the notification screen.

Customisation

CustomUniversalFeedScreen.swift
class CustomUniversalFeedScreen: LMUniversalFeedScreen {
override func setupAppearance() {
super.setupAppearance()
tableView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.universalFeedScreen = CustomUniversalFeedScreen.self
// ...
return true
}