ChooseApartmentsTableViewCell.swift 2.16 KB
//
//  ChooseApartmentsTableViewCell.swift
//  InterQR-Internship
//
//  Created by Дмитрий Тимофеев on 14.06.2022.
//

import UIKit

class ChooseApartmentsTableViewCell: UITableViewCell {
    static let id = "ChooseApartmentsTableViewCell-ID"
    
    var apartmanImage: UIImageView = {
        var obj = UIImageView()
        obj.image = UIImage(named: "Apartman")
        return obj
    }()
    
    var clientNameLabel: UILabel = {
        var obj = UILabel()
        obj.text = "Bares Family"
        obj.textColor = UIColor(red: 0.196, green: 0.216, blue: 0.333, alpha: 1)
        obj.font = .skModernist(type: .bold, ofSize: 16)
        return obj
    }()
    
    var adressLabel: UILabel = {
        var obj = UILabel()
        obj.text = "200 5th Ave"
        obj.textColor = UIColor(red: 0.725, green: 0.725, blue: 0.725, alpha: 1)
        obj.font = .skModernist(type: .regular, ofSize: 14)
        return obj
    }()
    
    var nextPointerImage: UIImageView = {
        var obj = UIImageView()
        obj.image = UIImage(named: "NextPointer")
        return obj
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        layout()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func layout() {
        addSubview(apartmanImage)
        addSubview(clientNameLabel)
        addSubview(adressLabel)
        addSubview(nextPointerImage)
        
        apartmanImage.snp.makeConstraints {
            $0.top.equalToSuperview().offset(8)
            $0.leading.equalToSuperview()
        }
        clientNameLabel.snp.makeConstraints {
            $0.top.equalToSuperview().offset(20)
            $0.leading.equalTo(apartmanImage.snp.trailing).offset(18)
        }
        adressLabel.snp.makeConstraints {
            $0.top.equalTo(clientNameLabel.snp.bottom).offset(5)
            $0.leading.equalTo(clientNameLabel.snp.leading)
        }
        nextPointerImage.snp.makeConstraints {
            $0.centerY.equalToSuperview()
            $0.trailing.equalToSuperview().offset(-26)
        }
    }
}