Привет, у меня есть это сомнение, могу ли я закончить контроль обновления в другом классе? В моей tableviewcontroller у меня есть это:Как я могу завершить обновление в другом классе?
func setRefreshGesture() {
let refreshGesture = UIRefreshControl()
refreshGesture.backgroundColor = UIColor.clearColor()
refreshGesture.tintColor = UIColor.whiteColor()
refreshGesture.addTarget(WorkUpdater.sharedInstance,action:#selector(WorkUpdater.attemptUpdateControl),forControlEvents:.ValueChanged)
self.refreshControl = refreshGesture
self.refreshControl?.layer.zPosition = self.tableView.backgroundView!.layer.zPosition + 1
}
и в моем другом классе .. есть это:
func attemptUpdateControl(){
if !isUpdating && canPerformUpdate() {
isUpdating = true
performUpdateControl()
} else {
print("ERROR: - Update in progress")
}
}
func performUpdateControl(){
let reach = Reachability.reachabilityForInternetConnection()!
if reach.isReachable() {
work.getData()
} else {
UIAlertView(title: "Device without connection", message: "You must have an internet connection to use this feature", delegate: nil, cancelButtonTitle: "OK").show()
// здесь я хочу закончить свое обновление в tableviewcontroller
}
}