Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing retain cycles in charts view controllers #486

Merged
merged 1 commit into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Loop/View Controllers/ChartsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class ChartsTableViewController: UITableViewController, UIGestureRecognizerDeleg

let notificationCenter = NotificationCenter.default
notificationObservers += [
notificationCenter.addObserver(forName: .UIApplicationWillResignActive, object: UIApplication.shared, queue: .main) { _ in
notificationCenter.addObserver(forName: .UIApplicationWillResignActive, object: UIApplication.shared, queue: .main) { [unowned self] _ in
self.active = false
},
notificationCenter.addObserver(forName: .UIApplicationDidBecomeActive, object: UIApplication.shared, queue: .main) { _ in
notificationCenter.addObserver(forName: .UIApplicationDidBecomeActive, object: UIApplication.shared, queue: .main) { [unowned self] _ in
self.active = true
}
]
Expand Down
2 changes: 1 addition & 1 deletion Loop/View Controllers/PredictionTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PredictionTableViewController: ChartsTableViewController, IdentifiableClas
let notificationCenter = NotificationCenter.default

notificationObservers += [
notificationCenter.addObserver(forName: .LoopDataUpdated, object: deviceManager.loopManager, queue: nil) { note in
notificationCenter.addObserver(forName: .LoopDataUpdated, object: deviceManager.loopManager, queue: nil) { [unowned self] note in
let context = note.userInfo?[LoopDataManager.LoopUpdateContextKey] as! LoopDataManager.LoopUpdateContext.RawValue
DispatchQueue.main.async {
switch LoopDataManager.LoopUpdateContext(rawValue: context) {
Expand Down
4 changes: 2 additions & 2 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class StatusTableViewController: ChartsTableViewController {
let notificationCenter = NotificationCenter.default

notificationObservers += [
notificationCenter.addObserver(forName: .LoopDataUpdated, object: deviceManager.loopManager, queue: nil) { note in
notificationCenter.addObserver(forName: .LoopDataUpdated, object: deviceManager.loopManager, queue: nil) { [unowned self] note in
let context = note.userInfo?[LoopDataManager.LoopUpdateContextKey] as! LoopDataManager.LoopUpdateContext.RawValue
DispatchQueue.main.async {
switch LoopDataManager.LoopUpdateContext(rawValue: context) {
Expand All @@ -64,7 +64,7 @@ final class StatusTableViewController: ChartsTableViewController {
self.reloadData(animated: true)
}
},
notificationCenter.addObserver(forName: .LoopRunning, object: deviceManager.loopManager, queue: nil) { _ in
notificationCenter.addObserver(forName: .LoopRunning, object: deviceManager.loopManager, queue: nil) { [unowned self] _ in
DispatchQueue.main.async {
self.hudView.loopCompletionHUD.loopInProgress = true
}
Expand Down