UIKit Programmatic View Controller Presentation #1222
Unanswered
BastianKusserow
asked this question in
Q&A
Replies: 1 comment
-
|
I think |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I've already looked into the UIKit case studies but am somehow stuck how to get programmatic UIKit view controller presentation working.
Assume I've got the following state and actions:
and the following reducers:
Now I'd like to present the detail screen if the user taps on a button in the main screen, which works just fine via scoping:
The problem now comes when trying to dismiss the detail view controller. Assuming one is using the standard UIKit sheet style, we have to be notified when the vc is dismissed when the user pulls down the sheet.
Therefore I send a
.backaction in the detail view controllersviewDidDisappearand everything works fine.But if I want to navigate programmatically, things get tricky. The
.backaction will be sent to the store when the user taps a button and the view controller gets dismissed properly. But after it is dismissed, the.backaction gets sent again becauseviewDidDisappearis called and a runtime warning will be displayed because the DetailState is already nil.Looking into the case studies I think I have to somehow handle that in the parent view controller but I am not sure how this should be done. Overriding
dismissin the parent and sending the.detail(.back)action there leads to some weird behaviours.I'd appreciate any help here!
Beta Was this translation helpful? Give feedback.
All reactions