Skip to content

Commit

Permalink
Update task info
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Apr 25, 2024
1 parent 9097986 commit 70d0c2e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
41 changes: 32 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ LiveView Native is a platform for building native applications using [Elixir](ht
# lib/my_app_web/live/hello_live.ex
defmodule MyAppWeb.HelloLive do
use MyAppWeb, :live_view
use LiveViewNative.LiveView,
formats: [:swiftui],
layouts: [
swiftui: {MyAppWeb.Layouts.SwiftUI, :app}
]
use MyAppNative, :live_view
end

# liv/my_app_web/live/hello_live_swiftui.ex
def MyAppWeb.HelloLive.SwiftUI do
use LiveViewNative.Component,
format: :swiftui,
as: :render
use MyAppNative, [:render_component, format: :swiftui]

def render(assigns, %{"target" => "watchos"}) do
~LVN"""
Expand All @@ -45,7 +39,36 @@ def MyAppWeb.HelloLive.SwiftUI do
end
```

To use LiveView Native in your Phoenix application, follow the instructions in the [getting started guide](https://hexdocs.pm/live_view_native/overview.html).
## Getting started

In addition to `live_view_native` you may want to include some additional libraries:

```elixir
{:live_view_native, "~> 0.3.0-rc.1"},
{:live_view_native_stylesheet, "~> 0.3.0-rc.1"},
{:live_view_native_swiftui, "~> 0.3.0-rc.1"},
{:live_view_native_stylesheet, "~> 0.3.0-rc.1"}
```

Then add the client plugin to `config/config.exs`

```
config :live_view_native, plugins: [
LiveViewNative.SwiftUI
]
```

then run:

```
$ mix lvn.setup
```

This task will several other tasks that will generate multiple files into your project.
A list of changes to several files in your Phoenix app will be printed after the task
completes. Please make sure to complete all of the `Required` changes otherwise LiveView Native
will not run properly.


## Learn more

Expand Down
4 changes: 2 additions & 2 deletions lib/mix/tasks/lvn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ defmodule Mix.Tasks.Lvn do

defp general() do
Application.ensure_all_started(:live_view_native)
Mix.shell().info "LiveViewNative v#{Application.spec(:live_view_native, :vsn)}"
Mix.shell().info "Build with Phoenix for anything with a screen."
Mix.shell().info "LiveView Native v#{Application.spec(:live_view_native, :vsn)}"
Mix.shell().info "Deploy LiveView applications to anything with a screen."
Mix.shell().info "\n## Options\n"
Mix.shell().info "-v, --version # Prints LiveView Native version\n"
Mix.Tasks.Help.run(["--search", "lvn."])
Expand Down

0 comments on commit 70d0c2e

Please sign in to comment.