Kurdtvs-Live-Kurdish-TV-Kur.../Mastodon/Scene/Search/SearchViewController+Search...

48 lines
1.9 KiB
Swift
Raw Normal View History

//
// SearchViewController+Searching.swift
// Mastodon
//
// Created by sxiaojian on 2021/4/2.
//
import Foundation
2021-04-06 09:25:04 +02:00
import MastodonSDK
import UIKit
extension SearchViewController {
func setupSearchingTableView() {
searchingTableView.delegate = self
searchingTableView.register(SearchingTableViewCell.self, forCellReuseIdentifier: String(describing: SearchingTableViewCell.self))
2021-04-06 09:25:04 +02:00
searchingTableView.register(SearchBottomLoader.self, forCellReuseIdentifier: String(describing: SearchBottomLoader.self))
view.addSubview(searchingTableView)
searchingTableView.constrain([
searchingTableView.frameLayoutGuide.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
searchingTableView.frameLayoutGuide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
searchingTableView.frameLayoutGuide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
searchingTableView.frameLayoutGuide.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
searchingTableView.contentLayoutGuide.widthAnchor.constraint(equalTo: view.widthAnchor),
])
2021-04-06 09:25:04 +02:00
searchingTableView.tableFooterView = UIView()
viewModel.isSearching
.receive(on: DispatchQueue.main)
2021-04-06 09:25:04 +02:00
.sink { [weak self] isSearching in
self?.searchingTableView.isHidden = !isSearching
}
.store(in: &disposeBag)
}
}
// MARK: - UITableViewDelegate
extension SearchViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
66
}
2021-04-06 09:25:04 +02:00
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
66
}
2021-04-06 09:25:04 +02:00
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {}
}