I have a problem with the UITableView, what happens is that I have a UITabBarController with 4 tabs, 2 of the tabs each have a UITableView (UITable1, UITable2) that use the same "Story" model, when requesting the information and make the UITable2 refresh and return to the tab with the UITable1, this takes the information that had more than the UITable2 this is the code that get the information:
UITable2 code
func loadStories() {
if !self.refreshControMute.isRefreshing {
PKHUD.sharedHUD.contentView = PKHUDProgressView()
PKHUD.sharedHUD.show()
}
ModelManager.sharedInstance.requestMuteStories { [unowned self] (isSuccess) in
DispatchQueue.main.async {
PKHUD.sharedHUD.hide()
if isSuccess {
self.bindUI()
self.tableMuteView.reloadData()
self.refreshControMute.endRefreshing()
} else {
}
}
}
}
func bindUI(){
self.title = "news_library".localized
let storiesMute = CoreStore.fetchAll(From(Story.self),Where<Story>
("isMute", isEqualTo: true))
// print("stories: \(stories?.count)")
if let storiesMute = storiesMute {
itemsMute = storiesMute
}
filter()
}
UITable1 code
func bindUI() {
self.title = "gbl_library".localized
let stories = CoreStore.fetchAll(From(Story.self), Where<Story>("isMute", isEqualTo: false))
if let stories = stories {
items = stories
}
filter()
}
func loadStories() {
if !self.refreshControl.isRefreshing {
PKHUD.sharedHUD.contentView = PKHUDProgressView()
PKHUD.sharedHUD.show()
}
ModelManager.sharedInstance.getAllStories { [unowned self] (isSuccess) in
DispatchQueue.main.async {
PKHUD.sharedHUD.hide()
if isSuccess {
self.bindUI()
self.tableView.reloadData()
self.refreshControl.endRefreshing()
//self.loadServerImages()
} else {
}
}
}
}
Any reason why the data is combined if they are in different UIViewController?