liveview-native / liveview-client-swiftui

MIT License
349 stars 30 forks source link

Change connection format #1131

Closed bcardarella closed 8 months ago

bcardarella commented 10 months ago

When the client connects it sends over:

def render(
        %{native: %{platform_config: %{user_interface_idiom: ui_idiom}}, platform_id: :swiftui} =
          assigns)

Instead the client should move over to this form:

def render(%{platform: platform, target: target} = assigns) do

now we can simply do things like:

def render(%{platform: :swiftui, target: :watchos} = assigns) do
def render(%{platform: :swiftui, target: target} = assigns) when target in ~w{ipad macos}a do
bcardarella commented 10 months ago

I realize this presents two words that can't be used in assigns. We could do

def(%{native: %{platform: plaform, target: target}} = assigns)

or even better:

def render(%{platform: :swiftui, target: :watchos} = assigns.native)
supernintendo commented 10 months ago

@bcardarella @AZholtkevych This format is actually determined by https://github.com/liveview-native/live_view_native and not the Swift client, so I think this issue should be moved there.

bcardarella commented 10 months ago

@supernintendo I'm suggesting that we send it in a normalized fashion from the client rather than correcting it in Elixir