Created
June 26, 2022 07:56
-
-
Save alibahaaa/b1d81784a8d113db6bc74961557ea02c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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