tabbar1 - I'm using core-bluetooth to connect to some peripherals. Once it connects, I update an array.
func populateFoundBTArray(peripheral: CBPeripheral, service:CBService) {
discoveredBTDevices.append(BTPeripheral.init(
id: discoveredBTDevices.count,
name: peripheral.name!,
uuid: peripheral.identifier,
desc: service.uuid.description
connected: peripheral.state == .connected ? true : false ))
}
in TabBar2 - I have some prototype (custom) cells hooked up via a XIB file via a combo of Static Cells and dynamic cells (similar to this solution - https://stackoverflow.com/a/49157374/14414215)
within TabBar2 - I have the tableView.reloadData()
call which is great whereby, whenever I switch to this tabbar2, the tableview will get updated. (but I have to physically go to tabbar1 --> tabbar2 to trigger this update)
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
tableView.reloadData()
}
my goal Is would like to be able to get the tableview to reload whenever the array discoveredBTDevices
gets updated.
I did try
let pop = tabbar2()
pop.tableView.reloadData() // also tried reloadSections(1 but didn't work
along with some more answers I found on SO but none of them worked. (I did not try any segues / notifications as currently I just have the discoveredBTDevices as a global variable to simplify my initial test)