Video Feed
Overview
The Video Feed Screen (LMFeedVideoFeedScreen
) provides an interface for browsing and interacting with video-based feeds.
File Location:
LMFeedVideoFeedScreen.swift
Functionality
Protocols Implemented
LMFeedVideoFeedViewModelDelegate
Defines methods that are triggered from the view model and are implemented by the view controller using it
navigateToCreateShortVideo()
: Called when the user wants to create a new short video post. This method handles the navigation to the video creation screen.
UI Components
newPostButton
: A button displayed in the navigation bar for creating new video posts.videoListScreen
: ALMFeedVideoListScreen
instance that manages the video content display.videoFeedNavBar
: A navigation bar view with a semi-transparent background.navBarTitleLabel
: A label displaying the "Reels" title in the navigation bar.createPostLoaderView
: A view for displaying post creation progress.
Data Variables
isPostCreationInProgress
: A boolean flag indicating if a post is currently being created.
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.addChildViewController()
: Adds and configures the video list screen as a child view controller.postCreationInProgress(notification:)
: An observer that shows the createPostLoaderView when post creation starts.postCreationSuccessful()
: An observer that hides the createPostLoaderView when the post is successfully created.postError(notification:)
: An observer that displays an error when an error occurs during post creation.
Action Handlers
didTapNewPost()
: Called when the "New Post" button is tapped.
Customization
CustomVideoFeedScreen.swift
class CustomVideoFeedScreen: LMFeedVideoFeedScreen {
override func setupAppearance() {
super.setupAppearance()
videoFeedNavBar.backgroundColor = .darkGray
navBarTitleLabel.textColor = .white
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.feedVideoFeedScreen = CustomVideoFeedScreen.self
// ...
return true
}