Closed ByeongUkChoi closed 8 months ago
@ByeongUkChoi These proposed changes have already been implemented in the next
branch of this repo. This is happening because of a version mismatch between live_view_native
and liveview-client-swiftui
within your project:
main
branch of liveview-client-swiftui
, you're using bleeding edge changes of the SwiftUI LVN client. In that case, you should use the next
branch of this repo in your Elixir app which includes the changes you describe in this issue (merged in https://github.com/liveview-native/live_view_native/pull/60). In your mix.exs:# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
deps do
[
# ...
{:live_view_native, git: "https://github.com/liveview-native/live_view_native", branch: "next"},
{:live_view_native_swift_ui, git: "https://github.com/liveview-native/liveview-client-swiftui", branch: "main"}
# ...
]
end
live_view_native
in your Elixir app (like 0.1
), you'll need to also use a tagged release of liveview-client-swiftui
(like 0.1.2
) instead of main
. In your Xcode project:Oh just one more thing to note; the next
branch of this repo is currently incompatible with the liveview-client-swiftui
unless you're using this branch - https://github.com/liveview-native/liveview-client-swiftui/pull/1154. Using a non bleeding-edge / versioned release for both dependencies avoids this.
@supernintendo Hi~
Sources/LiveViewNative/Coordinators/LiveSessionCoordinators.swift
In this file, you are sending the platform value with the key _lvn_platform
. However, there is still no part of https://github.com/liveview-native/live_view_native/tree/next or https://github.com/liveview-native/liveview-client-swiftui/pull/1154 parsing the _lvn_platform
.
@supernintendo
Oh Now It works. It changed from :platform
to :format
def render(%{format: :swiftui} = assigns) do
~SWIFTUI"""
<VStack>
<Text>
Hello native!
</Text>
</VStack>
"""swiftui
end
@ByeongUkChoi Oh right, I forgot to mention that as well. There are a number of breaking changes in the next
branch that we'll document with the actual release of 0.2; right now a few things are in flux and subject to change. Thank you for your patience as we get the next version ready to publish 🙂
Also, that _lvn_platform
param actually seems to be dead code in the Swift client but I'll look into it a bit more to confirm. The actual connection params have been moved to a map called _lvn
; the relevant code for that on both ends is here:
liveview-client-swiftui
:
https://github.com/liveview-native/liveview-client-swiftui/blob/main/Sources/LiveViewNative/Coordinators/LiveViewCoordinator.swift#L238
and
https://github.com/liveview-native/liveview-client-swiftui/blob/main/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift#L405
live_view_native
:
https://github.com/liveview-native/live_view_native/blob/next/lib/live_view_native/live_session.ex#L36
https://github.com/liveview-native/live_view_native/blob/main/lib/live_view_native/live_session.ex#L46
as shown above liveview-native can find the platform_id when the app requests
However, my app requests as follows
I just installed it with this command
It's probably because it's spent here. https://github.com/liveview-native/liveview-client-swiftui/blob/main/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift#L222
So what do you think about adding this function to the
LiveViewNative.LiveSession
module as a buffer code?