summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Protocols/CellFactoryProtocol.swift
blob: 7bf3cbda21c10eebef3cbc2dbae8edeca327a461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//
//  CellFactoryProtocol.swift
//  MullvadVPN
//
//  Created by Jon Petersson on 2023-03-09.
//  Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

import UIKit

/// Protocol for creating factories to make ``UITableViewCell``s of various kinds.
/// Typically used in conjunction with a ``UITableViewDiffableDataSource.CellProvider``.
protocol CellFactoryProtocol {
    associatedtype ItemIdentifier

    var tableView: UITableView { get }

    func makeCell(for item: ItemIdentifier, indexPath: IndexPath) -> UITableViewCell
    func configureCell(_ cell: UITableViewCell, item: ItemIdentifier, indexPath: IndexPath)
}