Slide 12
Slide 12 text
Code with SwiftBond
final class RequestListViewModel {
let items: DynamicArray = DynamicArray([])
var requestListState = Dynamic(.None)
var noDataFirstViewHidden: Dynamic {
let a = indicatorViewHidden.map { $0 == false }
let b = requestListFirstState.map { $0 == .Error }
return reduce(a, b) { $0 || $1 == true }
}
var indicatorViewHidden: Dynamic {
let a = requestListFirstState.map { $0 != RequestListState.Requesting }
let b = items.map { count($0) > 0 }
return reduce(a, b) { $0 || $1 == true }
}
var retryViewHidden: Dynamic {
let a = requestListFirstState.map { $0 != RequestListState.Error }
let b = items.map { count($0) > 0 }
return reduce(a, b) { $0 || $1 == true }
}
3FRVFTU4UBUFͱ*UFNTͷঢ়ଶͷΑΔڍಈΛએݴ