Kurdtvs-Live-Kurdish-TV-Kur.../Mastodon/Scene/Report/ReportResult/ReportResultViewModel+Diffa...

38 lines
1.0 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// ReportResultViewModel+Diffable.swift
// Mastodon
//
// Created by MainasuK on 2022-2-8.
//
import UIKit
import Combine
import CoreData
import CoreDataStack
import MastodonAsset
import MastodonLocalization
extension ReportResultViewModel {
static let reportItemHeaderContext = ReportItem.HeaderContext(
primaryLabelText: "Thanks for reporting, well look into this.",
secondaryLabelText: ""
)
func setupDiffableDataSource(
tableView: UITableView
) {
diffableDataSource = ReportSection.diffableDataSource(
tableView: tableView,
context: context,
configuration: ReportSection.Configuration()
)
var snapshot = NSDiffableDataSourceSnapshot<ReportSection, ReportItem>()
snapshot.appendSections([.main])
snapshot.appendItems([.header(context: ReportResultViewModel.reportItemHeaderContext)], toSection: .main)
snapshot.appendItems([.result(record: user)], toSection: .main)
diffableDataSource?.apply(snapshot)
}
}