Scenic (Scenic v0.10.4) View Source

The Scenic module itself is a supervisor that manages all the machinery that makes the Scenes, ViewPorts, and Drivers run.

In order to run any Scenic application, you will need to start the Scenic supervisor in your supervision tree.

Load a configuration for one or more ViewPorts, then add Scenic to your root supervisor.

defmodule MyApp do

  def start(_type, _args) do
    import Supervisor.Spec, warn: false

    # load the viewport configuration from config
    main_viewport_config = Application.get_env(:my_app :viewport)

    # start the application with the viewport
    children = [
      supervisor(Scenic, [viewports: [main_viewport_config]]),
    ]
    Supervisor.start_link(children, strategy: :one_for_one)
  end

end

Note that you can start the Scenic supervisor without any ViewPort Configurations. In that case, you are responsible for supervising the ViewPorts yourself. This is not recommended for devices as Scenic should know how to restart the main ViewPort in the event of an error.

Link to this section Summary

Functions

Return the current Mix env

Return the current version of scenic

Link to this section Functions

Return the current Mix env

Return the current version of scenic