To answer your question, one approach can be the multi arity approach:
def live_view() do
live_view([{AppWeb.Layouts, :app}, {:div, class: "flex min-h-svh"}])
end
def live_view(opts) do
layout = opts[:layout]
container = opts[:container]
quote do
use Phoenix.LiveView,
layout: unquote(layout),
container: unquote(container)
unquote(html_helpers())
end
end
To be able to help I think we’d need to see where you are calling your function from - not just where it’s defined.
From my reading of the code (returning AST from function, rather than a macro), you’re intending this function to be used at compile time. The error may well result from the module AppWeb not being compiled at the time you’re trying to call a function on it.
defmodule AppWeb.UserLoginLive do
use AppWeb, :live_view
end
I’m not quite sure how I’m going to pass the arguments, my intention was for the function to be called the same way as Phoenix.LiveView, inside the live.