Turbo Navigator abstracts routing boilerplate a single class. Use this level of abstraction for default handling of the following navigation flows.
When a link is tapped, turbo-ios sends a VisitProposal
to your application code. Based on the Path Configuration, different PathProperties
will be set.
- Current context - What state the app is in.
modal
- a modal is currently presenteddefault
- otherwise
- Given context - Value of
context
on the requested link.modal
ordefault
/blank
- Given presentation - Value of
presentation
on the proposal.replace
,pop
,refresh
,clear_all
,replace_root
,none
,default
/blank
- Navigation - The behavior that the navigation controller provides.
Current Context | Given Context | Given Presentation | New Presentation |
---|---|---|---|
default |
default |
default |
Push on main stack (or) Replace if visiting same page (or) Pop (and visit) if previous controller is same URL |
default |
default |
replace |
Replace controller on main stack |
default |
modal |
default |
Present a modal with only this controller |
default |
modal |
replace |
Present a modal with only this controller |
modal |
default |
default |
Dismiss then Push on main stack |
modal |
default |
replace |
Dismiss then Replace on main stack |
modal |
modal |
default |
Push on the modal stack |
modal |
modal |
replace |
Replace controller on modal stack |
default |
(any) | pop |
Pop controller off main stack |
default |
(any) | refresh |
Pop on main stack then |
modal |
(any) | pop |
Pop controller off modal stack (or) Dismiss if one modal controller |
modal |
(any) | refresh |
Pop controller off modal stack then Refresh last controller on modal stack (or) Dismiss if one modal controller then Refresh last controller on main stack |
(any) | (any) | clearAll |
Dismiss if modal controller then Pop to root then Refresh root controller on main stack |
(any) | (any) | replaceRoot |
Dismiss if modal controller then Pop to root then Replace root controller on main stack |
(any) | (any) | none |
Nothing |
To present forms (URLs ending in /new
or /edit
) as a modal, add the following to the rules
key of your Path Configuration.
{
"patterns": [
"/new$",
"/edit$"
],
"properties": {
"context": "modal"
}
}
To hook into the "refresh" turbo-rails native route, add the following to the rules
key of your Path Configuration. You can then call refresh_or_redirect_to
in your controller to handle Turbo Native and web-based navigation.
{
"patterns": [
"/refresh_historical_location"
],
"properties": {
"presentation": "refresh"
}
}