Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Fix "Pop problem"#9

Open
b0sya wants to merge 2 commits intoTouchInstinct:masterfrom
b0sya:master
Open

Fix "Pop problem"#9
b0sya wants to merge 2 commits intoTouchInstinct:masterfrom
b0sya:master

Conversation

@b0sya
Copy link
Copy Markdown

@b0sya b0sya commented Jun 3, 2021

"Pop problem" - pressing the "back" button of the navigation controller closes the screen, but the coordinator isn't destroyed

Example: The first flow screen must be added like this

router.push(module) { [weak self] in
self?.finishFlow()
}


func push(_ module: Presentable?)
func push(_ module: Presentable?,
completion: (() -> ())?)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

отступ поехал

completions.removeValue(forKey: controller)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишние пробелы

}

public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
guard let poppedViewController = navigationController.transitionCoordinator?.viewController(forKey: .from),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно добавить ссылку на источник проблемы и более подробное решение? Так как на первый взгляд неочевидно, что именно здесь пытаемся добиться.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В мои времена это делалось через CATransaction setCompletionBlock кхе-кхе
https://stackoverflow.com/a/27229945

import UIKit

open class StackRouter: StackRoutable {
open class StackRouter: NSObject, StackRoutable, UINavigationControllerDelegate {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Определение себя делегатом навигейшен контроллера в StackRouter убивает подписку в кастомной реализации UINavigationController в проекте. Кажется, это совершенно не очевидное поведение библиотеки

Copy link
Copy Markdown

@Loupehope Loupehope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Также требуется повышение версии

}

public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
guard let poppedViewController = navigationController.transitionCoordinator?.viewController(forKey: .from),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В мои времена это делалось через CATransaction setCompletionBlock кхе-кхе
https://stackoverflow.com/a/27229945

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants