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

File Location:
LMFeedNotificationItem.swift

UI Components

  • userImage: A LMFeedImageView that displays the user's profile picture.
  • mediaContainerView: A LMFeedView container for the optional media image.
  • mediaImage: A LMFeedImageView that displays the media image associated with the notification.
  • contentStack: A LMFeedStackView containing the titleLabel and timeLabel vertically.
  • titleLabel: A LMFeedLabel that displays the notification message.
  • timeLabel: A LMFeedLabel that 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
}