Skip to content

Commit 47d0ea7

Browse files
author
Giorgio Ruscigno
committed
Update PostListViewController, change notification observer caller method
1 parent c8e3c53 commit 47d0ea7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

WordPress/Classes/ViewRelated/Post/PostListViewController.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
217217
}
218218

219219
/// Shows/hides the create button based on the trait collection horizontal size class
220+
@objc
220221
private func toggleCreateButton() {
221222
if traitCollection.horizontalSizeClass == .compact {
222223
createButtonCoordinator.showCreateButton(for: blog)
@@ -387,13 +388,11 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
387388

388389
/// Listens for the app coming to foreground in order to properly set the create button
389390
private func listenForAppComingToForeground() {
390-
NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification,
391-
object: nil,
392-
queue: nil) { [weak self] _ in
393-
self?.toggleCreateButton()
394-
}
391+
NotificationCenter.default.addObserver(self,
392+
selector: #selector(toggleCreateButton),
393+
name: UIApplication.willEnterForegroundNotification,
394+
object: nil)
395395
}
396-
397396
// Mark - Layout Methods
398397

399398
override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {

0 commit comments

Comments
 (0)