IceCubesApp/Packages/StatusKit/Sources/StatusKit/List/StatusesFetcher.swift

24 lines
535 B
Swift
Raw Normal View History

import Combine
2022-12-19 11:28:55 +00:00
import Models
import Observation
2023-01-17 10:36:01 +00:00
import SwiftUI
2022-12-19 11:28:55 +00:00
public enum StatusesState {
public enum PagingState {
case hasNextPage, none
2022-12-19 11:28:55 +00:00
}
2023-01-17 10:36:01 +00:00
2022-12-19 11:28:55 +00:00
case loading
case display(statuses: [Status], nextPageState: StatusesState.PagingState)
case error(error: Error)
}
@MainActor
public protocol StatusesFetcher {
2022-12-19 11:28:55 +00:00
var statusesState: StatusesState { get }
func fetchNewestStatuses(pullToRefresh: Bool) async
func fetchNextPage() async throws
2023-01-31 07:04:35 +00:00
func statusDidAppear(status: Status)
func statusDidDisappear(status: Status)
2022-12-19 11:28:55 +00:00
}