- Add BookmarkLabel model and DTO - Create LabelsRepository and PLabelsRepository protocol - Add GetLabelsUseCase for fetching labels - Update BookmarkMapper to handle labels - Add LabelsView and LabelsViewModel for UI - Update BookmarksView and BookmarkLabelsView to display labels - Add green2 color asset for labels - Update API and repository layers to support labels
24 lines
560 B
Swift
24 lines
560 B
Swift
import Foundation
|
|
import Observation
|
|
|
|
@Observable
|
|
class LabelsViewModel {
|
|
private let getLabelsUseCase = DefaultUseCaseFactory.shared.makeGetLabelsUseCase()
|
|
|
|
var labels: [BookmarkLabel] = []
|
|
var isLoading = false
|
|
var errorMessage: String? = nil
|
|
|
|
@MainActor
|
|
func loadLabels() async {
|
|
isLoading = true
|
|
errorMessage = nil
|
|
do {
|
|
labels = try await getLabelsUseCase.execute()
|
|
} catch {
|
|
errorMessage = "Fehler beim Laden der Labels"
|
|
}
|
|
isLoading = false
|
|
}
|
|
}
|