# `Mob.App`
[🔗](https://github.com/genericjam/mob/blob/main/lib/mob/app.ex#L1)

Behaviour for Mob application entry point.

## Usage

    defmodule MyApp do
      use Mob.App

      def navigation(_platform) do
        stack(:home, root: MyApp.HomeScreen)
      end

      def on_start do
        Mob.Screen.start_root(MyApp.HomeScreen)
        Mob.Dist.ensure_started(node: :"my_app@127.0.0.1", cookie: :secret)
      end
    end

`use Mob.App` generates a `start/0` that the BEAM entry point calls. It
handles all framework initialization (native logger, navigation registry)
before delegating to `on_start/0`. App code only goes in `on_start/0`.

## Navigation

Implement `navigation/1` to declare the app's navigation structure.
Use the helper functions `stack/2`, `tab_bar/1`, and `drawer/1`:

    def navigation(:ios),     do: tab_bar([stack(:home, root: HomeScreen), ...])
    def navigation(:android), do: drawer([stack(:home, root: HomeScreen), ...])
    def navigation(_),        do: stack(:home, root: HomeScreen)

All `name` atoms used in stacks become valid `push_screen` destinations
without needing to reference modules directly.

# `navigation`

```elixir
@callback navigation(platform :: atom()) :: map()
```

# `on_start`
*optional* 

```elixir
@callback on_start() :: term()
```

App-specific startup hook. Called by the generated `start/0` after all
framework initialization is complete.

Override to start your root screen, configure Erlang distribution,
set the Logger level, etc. The default implementation is a no-op.

# `drawer`

```elixir
@spec drawer([map()]) :: map()
```

Declare a side drawer containing multiple named stacks.

Renders as a ModalNavigationDrawer on Android. iOS uses a custom slide-in
panel (native UIKit drawer support deferred).

# `stack`

```elixir
@spec stack(
  atom(),
  keyword()
) :: map()
```

Declare a navigation stack.

`name` is the atom identifier used with `push_screen/2,3`, `pop_to/2`,
and `reset_to/2,3`. The `:root` option is the module mounted when the stack
is first entered.

Options:
- `:root` (required) — screen module that is the stack's initial screen
- `:title` — optional display label shown in tabs or drawer entries

# `tab_bar`

```elixir
@spec tab_bar([map()]) :: map()
```

Declare a tab bar containing multiple named stacks.

Each branch must be a `stack/2` map. Renders as a bottom NavigationBar on
Android and a UITabBarController on iOS.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
