Link Cell
Overview
LMFeedPostLinkCell is a subclass of LMPostWidgetTableViewCell designed to display a post with link previews in the feed.

File Location:
LMFeedPostLinkCell.swift
Functionality
Protocols
LMFeedLinkProtocol
This protocol extends LMPostWidgetTableViewCellProtocol, incorporating functions specific to the link cell's interactions:
didTapLinkPreview(with url: URL): Invoked when the user taps on the link preview, facilitating navigation to the link's destination.
UI Components
linkPreveiw: An LMFeedLinkPreview used for displaying the link preview within the cell.
Data Variables
delegate: A weak reference to an instance ofLMFeedLinkProtocolto handle link preview tap events.postURL: Optionally stores the URL string associated with the link preview in the post.
Methods
configure(): Configures the cell with the provided data and sets up the delegate for cell interactions.
Action Handlers
didTapLinkPreview(): The selector method called when the link preview is tapped. It checks if the postURL is set and notifies the delegate.
Customisation
CustomLinkCell.swift
class CustomLinkCell: LMFeedPostLinkCell {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.linkCell = CustomLinkCell.self
// ...
return true
}