// // SPSearchResultView.swift // Thimra // // Created by 曾觉新 on 2025/4/18. // import UIKit class SPSearchResultView: UIView { private lazy var tableView: SPTableView = { let tableView = SPTableView(frame: .zero, style: .plain) tableView.delegate = self tableView.dataSource = self SPSearchResultCell.registerCell(tableView: tableView) return tableView }() override init(frame: CGRect) { super.init(frame: frame) // _setupUI() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } extension SPSearchResultView { private func _setupUI() { addSubview(tableView) tableView.snp.makeConstraints { make in make.edges.equalToSuperview() } } } //MARK: -------------- UITableViewDelegate & UITableViewDataSource -------------- extension SPSearchResultView: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = SPSearchResultCell.dequeueReusableCell(tableView: tableView, indexPath: indexPath) return cell } } extension SPSearchResultView { private func requestSearch(text: String) { // SPHomeAPI.requestSearch(text: text) } }