Commit 51789152 by Daniel Dahan

issue-919: fixed issue where view lifecycle functions were being called prematurely

parent cb949e27
## 2.12.4
* Updated to [Motion 1.2.3](https://github.com/CosmicMind/Motion/releases/tag/1.2.3).
* [issue-919](https://github.com/CosmicMind/Material/issues/919): Fixed issue where lifecycle methods were being called on tab item view controllers prematurely.
* [pr-923](https://github.com/CosmicMind/Material/pull/923): Merge PR that fixes [issue-919](https://github.com/CosmicMind/Material/issues/919).
## 2.12.3
* [issue-907](https://github.com/CosmicMind/Material/issues/907): Fixed Layout ordering issues.
......
Pod::Spec.new do |s|
s.name = 'Material'
s.version = '2.12.3'
s.version = '2.12.4'
s.license = 'BSD-3-Clause'
s.summary = 'A UI/UX framework for creating beautiful applications.'
s.homepage = 'http://materialswift.com'
......
Subproject commit b56ec4be55f32f5e9341860bc8cef7fa1bdcc77d
Subproject commit 9d898243db235f6f83e128bd632141bb36d73d84
......@@ -201,15 +201,15 @@ fileprivate extension TabsController {
return
}
guard let tvcIndex = viewControllers.index(of: viewController) else {
let tvc = viewController
guard let tvcIndex = viewControllers.index(of: tvc) else {
return
}
viewController.view.isHidden = false
viewController.view.frame = container.bounds
var isAuto = false
switch viewController.motionModalTransitionType {
switch tvc.motionModalTransitionType {
case .auto:
isAuto = true
viewController.motionModalTransitionType = fvcIndex < tvcIndex ? .slide(direction: .left) : .slide(direction: .right)
......@@ -222,23 +222,28 @@ fileprivate extension TabsController {
view.isUserInteractionEnabled = false
Motion.shared.transition(from: fvc, to: viewController, in: container) { [weak self, viewController = viewController, isAuto = isAuto, completion = completion] (isFinished) in
fvc.beginAppearanceTransition(false, animated: true)
Motion.shared.transition(from: fvc, to: viewController, in: container) { [weak self, tvc = tvc, isAuto = isAuto, completion = completion] (isFinished) in
guard let s = self else {
return
}
if isAuto {
viewController.motionModalTransitionType = .auto
tvc.motionModalTransitionType = .auto
}
s.rootViewController = viewController
s.rootViewController = tvc
s.view.isUserInteractionEnabled = true
s.removeViewController(viewController: fvc)
completion?(isFinished)
fvc.endAppearanceTransition()
completion?(isFinished)
if isTriggeredByUserInteraction {
s.delegate?.tabsController?(tabsController: s, didSelect: viewController)
s.delegate?.tabsController?(tabsController: s, didSelect: tvc)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment