RemoveAdvertTableViewCell.swift 1.84 KB
//
//  RemoveAdvertTableViewCell.swift
//  browser
//
//  Created by Artem Talko on 01.10.2023.
//
//MARK: Checked

import UIKit

final class RemoveAdvertTableViewCell: UITableViewCell {
    static let cellID = String(describing: RemoveAdvertTableViewCell.self)
    
    let advantagesCellLabel: UILabel = {
        let obj = UILabel()
        obj.font = FontConstants.regularFont_14
        
        return obj
    }()
    
    private let advantagesCellImage: UIImageView = {
        let obj = UIImageView()
        let checkmarkImg = UIImage(systemName: "checkmark")?.withTintColor(.blue, renderingMode: .alwaysOriginal)
        obj.image = checkmarkImg
        obj.contentMode = .scaleToFill
        
        return obj
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setup()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setup() {
        backgroundColor = .clear
        contentView.addSubview(advantagesCellLabel)
        contentView.addSubview(advantagesCellImage)
      
        setupConstraints()
    }
    
    private func setupConstraints() {
        advantagesCellImage.snp.makeConstraints { make in
            make.top.equalToSuperview().inset(5.sizeH)
            make.leading.equalToSuperview()
            make.bottom.equalToSuperview().inset(5.sizeH)
            make.trailing.equalTo(advantagesCellLabel.snp.leading).offset(-8.sizeW)
        }
        advantagesCellLabel.snp.makeConstraints { make in
            make.top.equalToSuperview().inset(5.sizeH)
            make.leading.equalTo(advantagesCellImage.snp.trailing)
            make.bottom.equalToSuperview().inset(5.sizeH)
            make.trailing.equalToSuperview()
        }
    }
}