HistoryView.swift
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// HistoryView.swift
// browser
//
// Created by Artem Talko on 29.09.2023.
//
import UIKit
final class HistoryView: UIView {
let historySearchBar: HistorySearchBarView = {
let obj = HistorySearchBarView()
obj.layer.cornerRadius = 10
obj.backgroundColor = UIColor(red: 0.913, green: 0.913, blue: 0.947, alpha: 1)
return obj
}()
let historyTabsTableView: UITableView = {
let obj = UITableView()
obj.separatorStyle = .none
return obj
}()
let historyToolbarView: HistoryToolbarView = {
let obj = HistoryToolbarView()
return obj
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setupUI() {
backgroundColor = .gray.withAlphaComponent(0.1)
addSubview(historySearchBar)
addSubview(historyTabsTableView)
addSubview(historyToolbarView)
setupConstraints()
}
private func setupConstraints() {
historySearchBar.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide.snp.top).offset(16.sizeH)
make.leading.trailing.equalToSuperview().inset(16.sizeW)
}
historyTabsTableView.snp.makeConstraints { make in
make.top.equalTo(historySearchBar.snp.bottom).offset(32.sizeH)
make.leading.trailing.equalToSuperview().inset(16.sizeW)
make.bottom.equalTo(historyToolbarView.snp.top).inset(7.sizeH)
make.height.equalTo(600.sizeH)
}
historyToolbarView.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview()
make.bottom.equalTo(safeAreaLayoutGuide.snp.bottom)
}
}
}
//MARK: - Helpers
extension HistoryView: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
historySearchBar.searchTextFieldView.text = ""
}
}