Skip to content

Instantly share code, notes, and snippets.

@alibahaaa
Created June 26, 2022 07:56
Show Gist options
  • Save alibahaaa/b1d81784a8d113db6bc74961557ea02c to your computer and use it in GitHub Desktop.
Save alibahaaa/b1d81784a8d113db6bc74961557ea02c to your computer and use it in GitHub Desktop.
import Foundation
import shared
class ViewModel: ObservableObject {
@Published var dataState = DataState.loading
private let getOrigamiUseCase: GetOrigamiUseCase = koin.get()
func loadOrigamies() {
self.dataState = DataState.loading
getOrigamiUseCase.invoke {entity, error in
if let entity = entity {
self.dataState = DataState.result(entity)
} else {
self.dataState = DataState.error
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment