We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class CustomView: UIView { // (μμμ£Όμ κ°μ΄ νμνλ€λ©΄ μ¬κΈ°) // MARK: - Views // MARK: - Output // βοΈ // MARK: - Properties // MARK: - Initializers // MARK: - LifeCycle // MARK: - Setup Methods // func setupView() // func setupConstraints() // MARK: - Input // βοΈ // MARK: - Private Methods } // MARK: - DataSource extension CustomView: DataSource { } // MARK: - Delegate extension CustomView: Delegate { }
MARK: - Setup Methods
func setupView() // λ·°λ₯Ό μ¬λ¦¬λ μμ μ func setupConstraints() // λ μ΄μμ μμ μ
Input
Output
View μ μ₯μμ μΈλΆλ‘ λΆν° λ°μμμΌ νλ κ°μ νλΌλ―Έν°λ‘ μ λ¬λ°κΈ° μν΄ μ‘΄μ¬νλ λ©μλ
λ©μλ
λλ₯Ό μμ±ν 주체μκ² ν΄λ‘μ ννλ‘ μ λ¬ λ°μ Event μμ μ μ€νμμΌ μ£Όκ³ μΆμ ν΄λ‘μ
ν΄λ‘μ
// MARK: - Setup Methods λ©μλ μλ // MARK: - Input λ§ν¬λ₯Ό μμ±νκ³ κ·Έ νμμ publicμΌλ‘ μμ±
// MARK: - Setup Methods
// MARK: - Input
public
configure
public func setConfigure(info: TravelCellInfo) { let (mainTitle, dateTitle) = info titleLabel.text = mainTitle dateLabel.text = dateTitle }
// MARK: - Properties μμ±λ€ μλ // MARK: - Output λ§ν¬λ₯Ό μμ±νκ³ κ·Έ νμμ publicμΌλ‘ μμ±
// MARK: - Properties
// MARK: - Output
on
public var onSelectedCell: (IndexPath -> Void)?
μμ
class TravelTableView: UITableView { // MARK: - Output public var onSelectedCell: (IndexPath -> Void)? // MARK: - Properties private var travelInfos: [TravelCellInfo] = [] { didSet { reloadData() } } // MARK: - Initializers override init(frame: CGRect, style: UITableView.Style) { super.init(frame: frame, style: style) setupView() setupConstraints() } required init?(coder: NSCoder) { super.init(coder: coder) setupView() setupConstraints() } // MARK: - Setup Methods private func setupView() { let travelCell = UINib(nibName: TravelTableViewCell.identifier, bundle: nil) register(travelCell, forCellReuseIdentifier: TravelTableViewCell.identifier) self.backgroundColor = .clear self.dataSource = self self.delegate = self } private func setupConstraints() {} // MARK: - Input public func setConfigure(info travelInfos: [TravelCellInfo]) { self.travelInfos = travelInfos } } // MARK: - DataSource extension TravelTableView: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return travelInfos.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: TravelTableViewCell.identifier, for: indexPath) as? TravelTableViewCell else { return UITableViewCell() } let travelInfo = travelInfos[indexPath.row] cell.setConfigure(info: travelInfo) return cell } } // MARK: - Delegate extension TravelTableView: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { onSelectedCell?(indexPath) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
μμ±, λ©μλ μμ± μμ
μμ
MARK: - Setup Methods
λͺ λͺ κ·μΉUIView μμμ
Input
Output
λͺ λͺ κ·μΉInput
μ΄λ?Output
μ΄λ?Input Ouput λͺ λͺ κ·μΉ
Input
// MARK: - Setup Methods
λ©μλ μλ// MARK: - Input
λ§ν¬λ₯Ό μμ±νκ³ κ·Έ νμμ
public
μΌλ‘ μμ±configure
λ‘ λλλλ‘ μμ±[μμ]
Output
// MARK: - Properties
μμ±λ€ μλ// MARK: - Output
λ§ν¬λ₯Ό μμ±νκ³ κ·Έ νμμ
public
μΌλ‘ μμ±on
μΌλ‘ μμνλλ‘ μμ±μμ
- UITavleViewλ₯Ό μμν TravelTableViewThe text was updated successfully, but these errors were encountered: