Skip to main content

Topic Selection

Overview

LMFeedTopicSelectionScreen provides a user interface for selecting topics. It displays a list of topics in a table view, with the ability to search and filter the topics.

LMFeedTopicSelectionScreen

Protocols

LMFeedTopicSelectionViewProtocol

This protocol defines a method for updating the topic feed with the selected topics:

  • updateTopicFeed(with topics: [LMFeedTopicDataModel]): Called when the user selects topics and taps the "Done" button.

UI Components

  • topicSelectionListView: A LMTableView instance that displays the list of topics.
    • Registered Cells: LMFeedTopicSelectionCell
  • searchController: A UISearchController instance for searching and filtering topics.

Data Variables

  • topicData: An array of arrays containing the topic data models for each section.
  • searchTimer: A Timer instance used for debouncing the search queries.
  • delegate: A weak reference to an instance conforming to LMFeedTopicSelectionViewProtocol for handling topic feed updates.

Action Handlers

  • didTapSelectButton(): The selector method for the "Done" button notifies the view model to handle the selected topics and send them back to the parent screen via a delegate.

Customization

CustomTopicSelectionScreen.swift
class CustomTopicSelectionScreen: LMFeedTopicSelectionScreen {
override func setupAppearance() {
super.setupAppearance()
tableView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.topicFeedSelectionScreen = CustomTopicSelectionScreen.self
// ...
return true
}