- 注意Swift的数组是结构体。用for model in array 修改model的方法行不通
应该直接对数组的值进行操作。参考下面:
func handlePicModel() {
guard let _ = truckPostModel.pics else { return }
for i in 0..<truckPostModel.pics!.count {
truckPostModel.pics![i].smallUrl = truckPostModel.pics![i].url?.getSmallImageString()
truckPostModel.pics![i].bigUrl = truckPostModel.pics![i].url?.getBigImageString()
}
}
网友评论