Chat Notification Cell
Overview
The LMChatNotificationCell is a specialized table view cell designed to display notification message. It presents informational text with customizable styling and supports interactive elements such as clickable URLs and routes.
File Location:
LMChatNotificationCell.swift
UI Components
infoLabel: A LMTextView that displays the notification message with customizable styling.
Properties
infoLabelTextFont: The font used for the notification text (default isAppearance.shared.fonts.textFont2).delegate: A weak reference to an object conforming toLMChatMessageBaseProtocolto handle user interactions.
Methods
tappedTextView(tapGesture:): Handles tap gestures on the text view, processing URL and route interactions.didTapRoute(route:): Delegates the handling of tapped routes.didTapURL(url:): Delegates the handling of tapped URLs.setData(with:): Configures the cell with the provided content model.
Customization
To customize the LMChatNotificationCell, you can subclass it and override the setup methods:
CustomChatNotificationCell.swift
class CustomChatNotificationCell: LMChatNotificationCell {
override func setupAppearance() {
super.setupAppearance()
infoLabel.backgroundColor = .systemBlue
infoLabel.textColor = .white
}
override func setData(with data: ContentModel) {
super.setData(with: data)
// Add custom data handling here
}
}
To use the custom notification cell:
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.chatNotificationCell = CustomChatNotificationCell.self
// ...
return true
}