aboutsummaryrefslogtreecommitdiff
path: root/foray/ForayNewTableViewCell.swift
blob: b2b22afbddc04ad387e4b8127d8f0ded30361722 (plain) (blame)
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
//
//  ForayNewTableViewCell.swift
//  foray
//
//  Created by Nicholas Tay on 18/3/2022.
//

import UIKit
import SnapKit

class ForayNewTableViewCell: UITableViewCell {
    
    let nameLabel: UILabel = UILabel()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        initialiseViews()
    }
    
    required init?(coder: NSCoder) {
        fatalError("unreachable")
    }
    
    private func initialiseViews() {
        contentView.addSubview(nameLabel)
        setupConstraints()
    }
    
    private func setupConstraints() {
        nameLabel.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview().inset(8)
            make.leading.trailing.equalToSuperview().inset(8)
        }
    }
    
    public func setData(str: String) {
        nameLabel.text = str
    }
}