ios – Refresh UITableView after getting information from NotificationCenter?


**I've Applied Notificationcenter for Broadcasting information from Delegate web page**

   override func viewWillAppear(_ animated: Bool) {
            NotificationCenter.default.addObserver(self, selector: #selector(self.handleNotification1(withNotification1:)), identify: NSNotification.Identify(rawValue:"id"), object: nil)

I wish to name gettenantlistforattendance() perform with an API, which must append array information in tableview array’s

@objc func handleNotification1(withNotification1 notification : NSNotification) {
    guard let userInfo = notification.userInfo,
        let i = userInfo[AnyHashable("fireDrillId")]! as? String else {
            print("No userInfo present in notification")
    print("information  :: (userInfo["fireDrillId"])")
    let fireID = userInfo["fireDrillId"] as? Int
    print("getting id (fireID ?? 0)")
    gettenantlistforattendance() //the issue is right here in that perform i've reload tableview however nonetheless not in a position to refresh tableview information

**The code i’ve applied in gettenantlistforattendance() for append array and reload tableview is **

for arr in tenantList.arrayValue{
    self.arrData.append(TernantList_Attendance_Model(json: arr))            
DispatchQueue.most important.async {
    self.presentCountlbl.textual content = self.totalpresent
    self.absentCountlbl.textual content = self.totalabsent
    self.missingCountlbl.textual content = self.totalmissing
    self.tableviewAttendance.separatorStyle = .none


Leave a Reply