2021-04-01 08:39:15 +02:00
|
|
|
//
|
|
|
|
// StatusFetchedResultsController.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-3-30.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import Combine
|
|
|
|
import CoreData
|
|
|
|
import CoreDataStack
|
|
|
|
import MastodonSDK
|
|
|
|
|
2023-11-22 12:32:04 +01:00
|
|
|
public final class StatusFetchedResultsController {
|
|
|
|
@MainActor
|
2023-11-22 13:18:41 +01:00
|
|
|
@Published
|
|
|
|
public private(set) var records: [MastodonStatus] = []
|
2021-04-01 08:39:15 +02:00
|
|
|
|
2023-11-22 12:32:04 +01:00
|
|
|
@MainActor
|
|
|
|
public init(records: [MastodonStatus] = []) {
|
|
|
|
self.records = records
|
2021-04-01 08:39:15 +02:00
|
|
|
}
|
|
|
|
|
2023-11-22 12:32:04 +01:00
|
|
|
@MainActor
|
|
|
|
public func reset() {
|
|
|
|
records = []
|
|
|
|
}
|
2022-01-27 14:23:39 +01:00
|
|
|
|
2023-11-22 12:32:04 +01:00
|
|
|
@MainActor
|
|
|
|
public func setRecords(_ records: [MastodonStatus]) {
|
|
|
|
self.records = records
|
2022-01-27 14:23:39 +01:00
|
|
|
}
|
|
|
|
|
2023-11-22 12:32:04 +01:00
|
|
|
@MainActor
|
|
|
|
public func appendRecords(_ records: [MastodonStatus]) {
|
|
|
|
self.records += records
|
2021-04-01 08:39:15 +02:00
|
|
|
}
|
|
|
|
}
|