Video Feed List
Overview
The Video Feed List (LMFeedVideoListScreen
) provides a vertical scrolling interface for displaying video content in a feed format. It supports video playback, user interactions, and post management features.
Functionality
Protocols Implemented
LMFeedVideoListViewModelProtocol
Defines methods that are triggered from the view model and are implemented by the view controller using it
showActivityLoader()
: Called to display the activity loader.showHideFooterLoader(isShow: Bool)
: Called to show or hide the footer loader.updateVideoList(with posts: [LMFeedPostContentModel], isInitialPage: Bool)
: Called to update the video list with new posts.navigateToReportScreen(for postID: String, creatorUUID: String)
: Called when tapped on report button to navigate to the report screen.navigateToDeleteScreen(for postID: String)
: Called when tapped on delete button to navigate to the delete screen.navigateToEditScreen(for postID: String)
: Called when tapped on edit button to navigate to the edit video post screen.
LMFeedPostHeaderViewProtocol
Defines methods for handling post header interactions.
LMFeedPostFooterViewProtocol
Defines methods for handling post footer interactions.
LMFeedVideoTextCellHeightDelegate
Defines methods for handling text cell height changes
videoTextCell(_ cell: LMFeedVideoTextCell, didChangeHeight height: CGFloat)
: Called when the text cell's height changes.
UI Components
videoCollectionView
: A collection view for displaying video content in a vertical scrolling format.createPostLoaderView
: A view for displaying post creation progress.taggingView
: A view for displaying and selecting mentioned users.inputTextView
: A text view for entering comments with user mention support.header
: A view displaying post author information and post metadata.footer
: A view containing post interaction buttons (like, comment, share).textCell
: A cell displaying post text content with expandable functionality.videoCollectionCell
: A cell for displaying video content with playback controls.videoListEndPage
: A view displayed when reaching the end of the video feed.
Data Variables
viewModel
: An instance ofLMFeedVideoListViewModel
managing the feed's business logic.data
: An array ofLMFeedPostContentModel
objects containing post data.taggingViewHeight
: A constraint for the tagging view's height.inputTextViewHeightConstraint
: A constraint for the input text view's height.textInputMinimumHeight
: The minimum height of the input text view.textInputMaximumHeight
: The maximum height of the input text view.
Methods
setupViews()
: Configures the initial view hierarchy.setupLayouts()
: Sets up the layout constraints for all UI components.setupActions()
: Configures action handlers for UI elements.setupAppearance()
: Customizes the visual appearance of the screen.updatePostList(with:isInitialPage:)
: Updates the post list with new content.updatePost(with:onlyHeader:onlyFooter:)
: Updates a specific post's content.handleVideoPlayback()
: Manages video playback for visible cells.configureEmptyListView()
: Sets up the empty state view.
Action Handlers
didTapViewOldPosts()
: Called when the "View Old Posts" button is tapped.postUpdated(notification:)
: Handles post update notifications.postDelete(notification:)
: Handles post deletion notifications.
Customization
CustomVideoListScreen.swift
class CustomVideoListScreen: LMFeedVideoListScreen {
override func setupAppearance() {
super.setupAppearance()
videoCollectionView.backgroundColor = .systemBackground
inputTextView.backgroundColor = .secondarySystemBackground
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.videoListScreen = CustomVideoListScreen.self
// ...
return true
}