Skip to main content

Media Cell

Overview

LMFeedPostMediaCell is a subclass of LMPostWidgetTableViewCell designed to display a post with media content (images or videos)

LMFeedPostMediaCell

UI Elements

  • mediaCollectionView: A collection view for displaying media content, such as images and videos.
  • pageControl: A UIPageControl indicating the current page in the media collection view.

Data Variables

  • mediaCellsData: An array holding the media content data to be displayed in the mediaCollectionView.

Methods

  • configure(): Configures the cell with the provided data and sets up the delegate for cell interactions.

  • setupMediaCells(): Initializes and configures the media cells based on the mediaData provided via configure() method

  • scrollingFinished(): Handles actions to be taken when scrolling in the media collection view is finished.

Customisation

CustomMediaCell.swift
class CustomMediaCell: LMFeedPostMediaCell {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.postCell = CustomMediaCell.self
// ...
return true
}