Skip to content

Commit

Permalink
[PanModal] Fix unbalanced calls to appearance (#52)
Browse files Browse the repository at this point in the history
* [PanModal] Use init instead of viewDidLoad in NavigationController

* [PanModal] Remove unbalanced calls to viewWillAppear/viewWillDisappear
  • Loading branch information
Stephen Sowole committed Sep 30, 2019
1 parent 0c6f9ff commit 9134d20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 0 additions & 4 deletions PanModal/Animator/PanModalPresentationAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public class PanModalPresentationAnimator: NSObject {

// Calls viewWillAppear and viewWillDisappear
fromVC.beginAppearanceTransition(false, animated: true)
toVC.beginAppearanceTransition(true, animated: true)

// Presents the view in shortForm position, initially
let yPos: CGFloat = presentable?.shortFormYPos ?? 0.0
Expand All @@ -94,7 +93,6 @@ public class PanModalPresentationAnimator: NSObject {
}, config: presentable) { [weak self] didComplete in
// Calls viewDidAppear and viewDidDisappear
fromVC.endAppearanceTransition()
toVC.endAppearanceTransition()
transitionContext.completeTransition(didComplete)
self?.feedbackGenerator = nil
}
Expand All @@ -111,7 +109,6 @@ public class PanModalPresentationAnimator: NSObject {
else { return }

// Calls viewWillAppear and viewWillDisappear
fromVC.beginAppearanceTransition(false, animated: true)
toVC.beginAppearanceTransition(true, animated: true)

let presentable = panModalLayoutType(from: transitionContext)
Expand All @@ -122,7 +119,6 @@ public class PanModalPresentationAnimator: NSObject {
}, config: presentable) { didComplete in
fromVC.view.removeFromSuperview()
// Calls viewDidAppear and viewDidDisappear
fromVC.endAppearanceTransition()
toVC.endAppearanceTransition()
transitionContext.completeTransition(didComplete)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ class NavigationController: UINavigationController, PanModalPresentable {

private let navGroups = NavUserGroups()

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
init() {
super.init(nibName: nil, bundle: nil)
viewControllers = [navGroups]
}

override func viewDidLoad() {
super.viewDidLoad()
pushViewController(navGroups, animated: false)
required init?(coder aDecoder: NSCoder) {
fatalError()
}

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

override func popViewController(animated: Bool) -> UIViewController? {
Expand Down

0 comments on commit 9134d20

Please sign in to comment.