Implemented the TableCell protocol in the UI library.
This commit is contained in:
parent
863f1c08ad
commit
fa81de0a66
@ -1,16 +0,0 @@
|
||||
//
|
||||
// CellIdentifiable.swift
|
||||
// ReviewsUIKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 21/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public protocol CellIdentifiable: UITableViewCell {
|
||||
|
||||
// MARK: Properties
|
||||
static var cellID: String { get }
|
||||
|
||||
}
|
33
Libraries/UI/Kit/Sources/Protocols/TableCell.swift
Normal file
33
Libraries/UI/Kit/Sources/Protocols/TableCell.swift
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// TableCell.swift
|
||||
// ReviewsUIKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 21/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public protocol TableCell: UITableViewCell {
|
||||
|
||||
// MARK: Properties
|
||||
static var cellID: String { get }
|
||||
|
||||
// MARK: Functions
|
||||
static func dequeue(from tableView: UITableView) -> UITableViewCell?
|
||||
static func register(in tableView: UITableView)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Implementations
|
||||
extension TableCell {
|
||||
|
||||
public static func dequeue(from tableView: UITableView) -> UITableViewCell? {
|
||||
tableView.dequeueReusableCell(withIdentifier: cellID)
|
||||
}
|
||||
|
||||
public static func register(in tableView: UITableView) {
|
||||
tableView.register(Self.self, forCellReuseIdentifier: cellID)
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user