HistorySearchBarView.swift
1.54 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
//
// HistorySearchBarView.swift
// browser
//
// Created by Artem Talko on 01.10.2023.
//
//MARK: Checked
import UIKit
final class HistorySearchBarView: UIView {
private let searchImageView: UIImageView = {
let obj = UIImageView()
let magnifyImage = UIImage(systemName: "magnifyingglass")?.withTintColor(.gray, renderingMode: .alwaysOriginal)
obj.image = magnifyImage
obj.contentMode = .scaleAspectFit
return obj
}()
let searchTextFieldView: UITextField = {
let obj = UITextField()
obj.text = StringConstants.search
obj.textColor = ColorConstants.gray
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() {
addSubview(searchImageView)
addSubview(searchTextFieldView)
setupConstraints()
}
private func setupConstraints() {
searchImageView.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(16.sizeW)
make.top.bottom.equalToSuperview().inset(8.sizeH)
make.height.equalTo(16.sizeH)
}
searchTextFieldView.snp.makeConstraints { make in
make.leading.equalTo(searchImageView).offset(32.sizeW)
make.trailing.equalToSuperview().offset(-16.sizeW)
make.top.bottom.equalToSuperview().inset(8.sizeH)
}
}
}