Skip to content

Instantly share code, notes, and snippets.

@micHar
Last active February 2, 2021 07:19
Show Gist options
  • Save micHar/76f0f7a4a27f354ff814ed3670ac1c20 to your computer and use it in GitHub Desktop.
Save micHar/76f0f7a4a27f354ff814ed3670ac1c20 to your computer and use it in GitHub Desktop.
@ToNativeClass(name = "LoadUserUseCaseIos", launchOnScope = MainScopeProvider::class)
class LoadUserUseCase(private val service: UserService){
suspend fun loadUser(username: String) : User? = service.loadUser(username)
fun getUserBlocking(username: String) : User? = service.getUser(username)
}
@ToNativeClass(name = "ObserveUsersUseCaseIos", launchOnScope = MainScopeProvider::class)
class ObserveUsersUseCase(private val service: UserService){
fun observeUsers(usersCount: Int) : Flow<User> = service.observeUsers(usersCount)
}
@ToNativeClass(name = "SaveUserUseCaseIos", launchOnScope = MainScopeProvider::class)
class SaveUserUseCase(private val service: UserService){
suspend fun saveUser(user: User) = service.sendUser(user)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment