SearchingView.swift
1.88 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
//
// SearchingView.swift
// browser
//
// Created by Artem Talko on 29.09.2023.
//
import UIKit
final class SearchingView: UIView, UITextFieldDelegate {
let searchingButton: UIButton = {
let obj = UIButton()
obj.setImage(UIImage(systemName: "arrow.left"), for: .normal)
return obj
}()
let searchingLabel: UILabel = {
let obj = UILabel()
obj.text = "Searching"
obj.font = FontConstants.semiboldFont_18
return obj
}()
let searchTableView: UITableView = {
let obj = UITableView()
obj.backgroundColor = .clear
obj.separatorStyle = .none
return obj
}()
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setup() {
addSubview(searchingButton)
addSubview(searchingLabel)
addSubview(searchTableView)
setupConstaraints()
backgroundColor = .white
}
private func setupConstaraints() {
searchingButton.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide.snp.top).offset(16.sizeH)
make.leading.equalToSuperview().offset(16.sizeW)
make.height.equalTo(24.sizeH)
}
searchingLabel.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide.snp.top).offset(16.sizeH)
make.leading.equalTo(searchingButton.snp.trailing).offset(109.sizeW)
make.trailing.equalToSuperview().offset(-138.sizeW)
}
searchTableView.snp.makeConstraints { make in
make.top.equalTo(searchingLabel.snp.bottom).offset(16.sizeH)
make.leading.trailing.equalToSuperview().inset(16.sizeW)
make.bottom.equalToSuperview()
}
}
}