Routes
Places as addresses, kept in step with the address bar or the back stack.
Desktop
arkui::route · arkui::url
url::encoded("North/South #1 · é") | North%2FSouth%20%231%20%C2%B7%20%C3%A9 |
url::decode(url::encoded(…)) | North/South #1 · é |
route::join("place", Some("North/South #1 · é")) | #place/North%2FSouth%20%231%20%C2%B7%20%C3%A9 |
A place is its address: walking a sidebar writes the bar, and back and forward come back through Router::poll.
arkui::route
Places as URL fragments, and the address bar kept in step: reconciled, not pushed, and a scrub one history entry. Each page here has one.
trait Route { fragment(), parse() }join(kind, name), split(fragment)Router::new(), sync(&place), replace_next(), poll(ready), go(by), can_go(by)AddressBar, Browser, Nav
Rules
parsenever fails: an unknown fragment is home.- Call
syncafter every update.
arkui::url
Percent-encoding for a fragment, so a /, a # or an accent survives the address bar.
encode(s, &mut out)encoded(s)decode(s)
Mobile
Where
ui/Destination.kt: Destination, Destinations
How
- Destination(owner, name) { content }: a page's own ViewModel store, kept while it is on the stack.
Nothing shared for this on iOS yet.