feat: 定义仓库协议与用例(含会话)

This commit is contained in:
AndyChen1024
2026-09-15 14:35:52 +08:00
parent 14eb5ad44d
commit ec1eed8f04
10 changed files with 139 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
import CoreModel
/// 获取 Home 数据的用例。
/// Kotlin: class HomeUseCase(...) { suspend operator fun invoke(): HomeData }
public struct HomeUseCase: Sendable {
private let repository: HomeRepository
@@ -9,8 +8,13 @@ public struct HomeUseCase: Sendable {
self.repository = repository
}
/// Kotlin: Flow<HomeData> → Swift: AsyncThrowingStream<HomeData, Error>
/// 已登录首页。
public func observeHome() -> AsyncThrowingStream<HomeData, Error> {
repository.observeHome()
}
/// 游客首页。
public func observeGuestHome() -> AsyncThrowingStream<HomeData, Error> {
repository.observeGuestHome()
}
}