Files
2023-03-02 18:28:42 +03:00

41 lines
1.4 KiB
Swift

//
// CryptoChatViewChatsHeader.swift
// Wallet
//
// Created by Saveliy Stavitsky on 8/18/20.
// Copyright © 2020 List. All rights reserved.
//
import UIKit
import WalletUIComponents
final class CryptoChatViewChatsHeader: UIView {
let searchTextField: CommonTextFieldSearch
private enum Constants {
static let padding: CGFloat = 12
static let topPadding: CGFloat = 11
}
init(width: CGFloat, viewModel: TextFieldViewModel) {
self.searchTextField = CommonTextFieldSearch(viewModel: viewModel)
super.init(frame: .zero)
let textField = UIHostingView(rootView: self.searchTextField, autoresizingMask: false)
self.addSubview(textField)
NSLayoutConstraint.activate([
self.widthAnchor.constraint(equalToConstant: width),
textField.topAnchor.constraint(equalTo: self.topAnchor, constant: Constants.topPadding),
textField.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: Constants.padding),
textField.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -Constants.padding),
textField.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -Constants.padding)
])
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}