Sandbox works as follows.
This can also be seen in the following code.
#[derive(Debug, Clone)]
enum Message {
// ...
}
struct MyApp {
// ... (Some fields for the app state)
}
impl Sandbox for MyApp {
type Message = Message;
fn new() -> Self {
Self {
// ...
}
}
fn title(&self) -> String {
// Title of the window
}
fn update(&mut self, message: Self::Message) {
match message {
// Update logic
}
}
fn view(&self) -> iced::Element<Self::Message> {
// View logic
}
}
➡️ Next: Adding Widgets
📘 Back: Table of contents