闭包的声明 实现以及调用

1闭包的声明

 var chooseHouseSourceClosure: (([HouseSoueceEntity])->())? // 已选房源

闭包的实现

 self.chooseHouseSourceClosure?(self.selectedSoueceEntityArray)

闭包的调用

houseSourceVC.chooseHouseSourceClosure = { [weak self] (houses) in
                // 房源选择结束 调用选择房源结束的闭包
                self?.selectedSoueceEntityArray.removeAll()
                for house in houses {
                    self?.selectedSoueceEntityArray.append(house)
 }

你可能感兴趣的:(闭包的声明 实现以及调用)