Skip to main content

root_view

Function root_view 

Source
pub fn root_view(builder: fn(i64) -> ViewHandle) -> ViewHandle
Expand description

Build the application’s root view, or return the one already built.

builder receives the current generation, which most callers ignore: the point is that it runs again whenever refresh is called, and reads whatever Rust state holds at that moment.

Must be called on the main thread.

Examples found in repository?
examples/dashboard.rs (line 99)
98fn content_view() -> swiftui_native::ViewHandle {
99    state::root_view(|_| body().into_handle())
100}
More examples
Hide additional examples
examples/inbox.rs (line 123)
122fn content_view() -> swiftui_native::ViewHandle {
123    state::root_view(|_| body().into_handle())
124}
examples/settings.rs (line 121)
120fn content_view() -> swiftui_native::ViewHandle {
121    state::root_view(|_| body().into_handle())
122}
examples/todo.rs (line 132)
131fn content_view() -> swiftui_native::ViewHandle {
132    state::root_view(|_| body().into_handle())
133}
examples/swift_org_tutorial.rs (line 176)
175fn content_view() -> swiftui_native::ViewHandle {
176    state::root_view(|_generation| body().into_handle())
177}
examples/dynamic_ui.rs (line 83)
82fn content_view() -> swiftui_native::ViewHandle {
83    swiftui_native::state::root_view(|_| body().into_handle())
84}