Skip to main content

Notification Item

Overview

LMFeedNotificationItem is used to display notification. It includes information such as the notification message, the time of the notification, user details, and an optional media image. The view highlights whether the notification has been read.

LMFeedNotificationView

UI Componenets

  • userImage: Displays the user's profile picture.
  • mediaContainerView: A container for the optional media image.
  • mediaImage: Displays the media image associated with the notification.
  • contentStack: A vertical stack view containing the titleLabel and timeLabel.
  • titleLabel: Displays the notification message.
  • timeLabel: Shows when the notification was sent.

Data Variables

  • userImageHeight: Specifies the height of the user's profile picture.
  • mediaImageHeight: Defines the height of the media image.
  • onTapCallback: A closure that is executed when the notification view is tapped.

Methods

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

Action Handlers

  • didTapNotificationView(): The selector method called when notification is tapped.

Customisation

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