Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let roomsData = QRoom.all() // get from database
- var withIds = [String]()
- for item in roomsData {
- withIds.append(item.id) // add to array temporary
- }
- var newIds = ["212"] // if there is new data, example room id
- var set1 = Set(newIds)
- var set2 = Set(withIds)
- let filter = Array(set1.subtracting(set2)) // check whether is exist in database or not
- if(filter.count > 0){
- // if there is no in database then call room info API server
- Qiscus.roomsInfo(withIds: filter, onSuccess: { (qRooms) in
- // success gaining rooms
- }) { (error) in
- // error gaining rooms
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement