Skip to main content

Link Content View

Overview

The LMChatLinkPreviewContentView is a custom view that extends LMChatMessageContentView to display link previews within chat messages. It integrates the LMChatMessageLinkPreview component to show rich link previews including thumbnails, titles, and descriptions.

UI Components

Methods

  • setDataView(): Updates the view's content based on the provided data.
  • linkPreview(): Configures the link preview with data from the message's OG tags.

Customization

CustomChatLinkPreviewContentView.swift
class CustomChatLinkPreviewContentView: LMChatLinkPreviewContentView {
override func setupViews() {
super.setupViews()
// Add custom view setup here
}

override func setDataView(_ data: LMChatMessageCell.ContentModel, index: IndexPath) {
super.setDataView(data, index: index)
// Add custom data handling here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// Register custom link preview content view class if needed
LMUIComponents.shared.linkContentView = CustomChatLinkPreviewContentView.self
// ...
return true
}