Skip to content

A platform for building native applications with Phoenix LiveView

License

Notifications You must be signed in to change notification settings

sophinauta/live_view_native

This branch is 1 commit ahead of, 351 commits behind liveview-native/live_view_native:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d0b91af · Nov 7, 2023
Oct 23, 2023
Aug 17, 2023
Oct 16, 2023
Nov 7, 2023
Oct 16, 2023
Mar 7, 2023
Nov 7, 2023
Nov 6, 2022
Sep 14, 2023
Oct 16, 2023
Sep 5, 2023

Repository files navigation

LiveViewNative

Build Status Hex.pm Documentation

About

LiveView Native is a platform for building native applications using Elixir and Phoenix LiveView. It allows a single LiveView to serve both web and non-web clients by transforming platform-specific template code into native UIs:

# lib/my_app_web/live/hello_live.ex
defmodule MyAppWeb.HelloLive do
  use Phoenix.LiveView
  use LiveViewNative.LiveView

  @impl true
  def render(%{platform_id: :swiftui} = assigns) do
    # This UI renders on iOS
    ~SWIFTUI"""
    <VStack>
      <Text>
        Hello native!
      </Text>
    </VStack>
    """
  end

  @impl true
  def render(%{} = assigns) do
    # This UI renders on the web
    ~H"""
    <div class="flex w-full h-screen items-center">
      <span class="w-full text-center">
        Hello web!
      </span>
    </div>
    """
  end
end

To use LiveView Native in your Phoenix application, follow the instructions in the getting started guide.

Learn more

About

A platform for building native applications with Phoenix LiveView

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 99.9%
  • HTML 0.1%