Skip to content

Persistence in SwiftUI #120

@Tyler-Keith-Thompson

Description

@Tyler-Keith-Thompson

Is your feature request related to a problem? Please describe.

In UIKit flowPersistence is a deliberately supported feature. in SwiftUI right now removedAfterProceeding is supported (partially by accident) and persistWhenSkipped really isn't. I'd like to see support for those, if possible.

Describe the solution you'd like

For default presentation:

removedAfterProceeding means the @State variable holding onto the view is cleared, this is mostly useful for animations.
persistWhenSkipped I do not believe has any real meaning here, if it's skipped with our default presentation mode then there's really nothing to persist.

For navigation links:

removedAfterProceeding in a perfect world this (somehow) animates in the next view then retroactively changes the back-stack to remove the item you just proceeded from. However I think that's impossible because of how animations for Navigation Views and back stack management work in SwiftUI. So I'm fine with the new view merely replacing the one that gets removed after proceeding.
persistWhenSkipped means that a skipped item is in the backstack. You can navigate backward to it, but when you navigate forward from the previous item it's not animated in. (Again, realizing that animations may be very hard to control here)

For modals:

removedAfterProceeding in a perfect world this (somehow) animates in the next view then retroactively changes the back-stack to remove the item you just proceeded from. However I think that's impossible because of back stack management work in SwiftUI. So I'm fine with the new view merely replacing the one that gets removed after proceeding.
persistWhenSkipped means that a skipped item is in the backstack. You can dismiss backward to it, but when you navigate forward from the previous item it's not animated in. (Again, realizing that animations may be very hard to control here)

Describe alternatives you've considered

Expressly have an error (ideally compile time) that stops users from being able to apply persistences that do not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions