Notification
Overview
The LMFeedNotificationFeedScreen
is designed to present a list of notifications to the user. Users can pull to refresh the list of notifications, and the screen shows an empty state view when there are no notifications to display. It supports navigating to different parts of the app based on the notification's content.
UI Components
notificationListView
: ALMTableView
used to display notifications- Registered Cells: LMFeedNotificationItem
refreshControl
:UIRefreshControl
fortableView
emptyNotificationView
: An instance ofLMFeedEmptyNotificationView
to show when there are no notifications to view.
Data Variables
notificationData
: An array of notifications cell data
Methods
pullToRefresh()
: Triggers a refresh of the notifications list.navigateToPost(from:)
: Handles navigation to a specific post based on a given route. This method takes aString
route as input and usesLMFeedRouter
to fetch the corresponding view controller. If successful, it pushes the view controller onto the navigation stack.showHideLoaderView(isShow: Bool, backgroundColor: UIColor)
: Controls the visibility of the loading indicator. WhenisShow
istrue
, it starts therefreshControl
animation. WhenisShow
isfalse
, it stops therefreshControl
animation.
Customisation
CustomNotificationScreen.swift
class CustomNotificationScreen: LMFeedNotificationScreen {
override func setupAppearance() {
super.setupAppearance()
tableView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.notificationScreen = CustomNotificationScreen.self
// ...
return true
}