View Source Scenic (Scenic v0.11.2)
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.