mastodon-ios/Mastodon/Scene/Onboarding/ServerRules/ServerRuleSection.swift

32 lines
1.0 KiB
Swift
Raw Normal View History

2022-01-05 08:11:35 +01:00
//
// ServerRuleSection.swift
// Mastodon
//
// Created by MainasuK on 2022-1-5.
//
import UIKit
import MastodonAsset
import MastodonLocalization
2022-01-05 08:11:35 +01:00
enum ServerRuleSection: Hashable {
case rules
}
extension ServerRuleSection {
static func tableViewDiffableDataSource(
tableView: UITableView
) -> UITableViewDiffableDataSource<ServerRuleSection, ServerRuleItem> {
return UITableViewDiffableDataSource(tableView: tableView) { tableView, indexPath, item in
switch item {
2023-10-04 18:20:42 +02:00
case .rule(let index, let rule):
2022-01-05 08:11:35 +01:00
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ServerRulesTableViewCell.self), for: indexPath) as! ServerRulesTableViewCell
2023-10-04 18:20:42 +02:00
cell.indexImageView.image = UIImage(systemName: "\(index + 1).circle") ?? UIImage(systemName: "questionmark.circle")
2022-12-18 02:08:58 +01:00
cell.indexImageView.tintColor = Asset.Colors.Brand.lightBlurple.color
2023-10-04 18:20:42 +02:00
cell.ruleLabel.text = rule.text
2022-01-05 08:11:35 +01:00
return cell
}
}
}
}