Skip to main content

Link Cell

Overview

The LMChatLinkPreviewCell is a subclass of LMChatMessageCell designed to display link preview messages in a chat interface. It encapsulates an LMChatLinkPreviewContentView to handle the presentation of link previews within the cell.

UI Components

Methods

  • setData(with:index:): Populates the cell with data from a ContentModel and configures the link preview click callback.

Customization

CustomLinkPreviewCell.swift
class CustomLinkPreviewCell: LMChatLinkPreviewCell {
override func setupViews() {
super.setupViews()
// Add custom views or modify existing ones
}

override func setData(with data: ContentModel, index: IndexPath) {
super.setData(with: data, index: index)
// Customize data population or add additional configuration
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.chatMessageLinkPreviewCell = CustomLinkPreviewCell.self
// ...
return true
}