FeatherweightLabs / FeatherweightRouter

Clean Swift Router and Coordinator for declarative routing tree matching
Apache License 2.0
102 stars 12 forks source link

Pop to parent route? #13

Open samritchie opened 8 years ago

samritchie commented 8 years ago

The Readme sez:

The user tapping a back button is easy to capture and generate and action that updates the State Path which causes the UI change.

I can capture a back navigation by doing the awkward viewWillDisappear/isMovingFromParentViewController dance, but updating the route is difficult unless the VC is aware of its exact position in the stack. If you’re using url-style strings, you could try to chop the last path component off, but there’s no guarantee this is the right route. If you’re using enums like any right-minded string-phobic Swift dev, you’re SOL.

The only place the parent route is reliably known is in the router stack, but there doesn’t seem to be any sensible way to access this. Is this something anyone has managed to solve?