Code Monkey home page Code Monkey logo

liveview-client-jetpack's Introduction

LiveViewNative

Client Spec {: .info}

format: :jetpack

module_suffix: Jetpack

template_sigil: ~LVN

component: LiveViewNative.Jetpack.Component

The LiveViewNative Jetpack package lets you use Phoenix LiveView to build native Android apps with Jetpack Compose.

Installation

  1. In Android Studio, select File โ†’ Add Packages...
  2. Enter the package URL https://github.com/liveview-native/liveview-client-jetpack
  3. Select Add Package

Usage

Create a LiveView to connect to a Phoenix server running on http://localhost:4000.

// add jetpack

Now when you start up your app, the LiveView will automatically connect and serve your native app.

Elixir Library

Installation

If available in Hex, the package can be installed by adding live_view_native_jetpack to your list of dependencies in mix.exs:

def deps do
  [
    {:live_view_native_jetpack, "~> 0.3.0"}
  ]
end

Then add the Jepack plugin to your list of LiveView Native plugins:

config :live_view_native, plugins: [
  LiveViewNative.Jetpack
]

Usage

This plugin provides the Jetpack rendering behavior of a Phoenix LiveView. Start by adding this plugin to a LiveView. We do this with LiveViewNative.LiveView:

defmodule MyAppWeb.HomeLive do
  use MyAppWeb :live_view
  use LiveViewNative.LiveView,
    formats: [:jetpack],
    layouts: [
      jetpack: {MyAppWeb.Layouts.Jetpack, :app}
    ]

end

then just like all format LiveView Native rendering components you will create a new module namespaced under the calling module with the module_suffix appended:

defmodule MyAppWeb.HomeLive.Jetpack do
  use LiveViewNative.Component,
    format: :jetpack

  def render(assigns, _interface) do
    ~LVN"""
    <Text>Hello, Jetpack!</Text>
    """
  end
end

Further details on additional options and an explanation of template rendering vs using render/2 are in the LiveView Native docs.

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/live_view_native_jetpack.

Resources

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.