我通过Bindable使用MVVM,我可以使用以下代码分配数组,但是我应该如何分配字典数据
func getSmallCaseList(id:String) {
showLoadingHud.value = true
appServerClient.getSmallCaseDetails(scid: id, completion: { [weak self] result in
self?.showLoadingHud.value = false
switch result {
case .success(let data):
guard data.success == true else {
//error -type of expression is ambiguous without more context
self?.caseDetailsCardCell.value = [.empty]
return
}
self?.caseDetailsCardCell.value = data.compactMap { .normal(cellViewModel: $0 as CaseCardCellVM)}
case .failure(let error):
self?.caseDetailsCardCell.value = [.error(message: error?.getErrorMessage() ?? "Loading failed, check network connection")]
}
})
}
了解更多代码详细信息link to gist
任何帮助都会非常有用
谢谢