- 向HMHome中添加HMZone
home.addZone(withName: "一楼") { (zone, error) in if error == nil{ print("创建一楼区域成功"); }else{ print("创建一楼区域失败"); } }
- 删除HMZone
home.removeZone(home.zones[indexPath.row]) { [weak self] (Error) in if Error == nil{ self?.tableView?.deleteRows(at: [indexPath], with: .fade) } }
- 给区域添加rooms
let room = self.home.rooms[0] let zone = self.home.zones[0] zone.addRoom(room) { (error) in if error == nil{ print("添加成功") for rooms in zone.rooms{//获取添加成功的房间 print("----------------\(rooms.name)") } }else{ print("添加失败") } }
- 给区域删除room
zone.removeRoom(room) { (error) in if error == nil{ print("删除成功") }else{ print("删除失败") } }
来源:https://www.cnblogs.com/hualuoshuijia/p/12016545.html