Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] fix runtime warnings for published variables in Xcode14 #84

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ios/packages/swiftui/Sources/SwiftUIPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public struct SwiftUIPlayer: View, HeadlessPlayer {
public init(contextBuilder: @escaping () -> JSContext = { JSContext() }) {
self.contextBuilder = contextBuilder
registryWatch = registry.objectWillChange.sink { [weak self] in
self?.objectWillChange.send()
DispatchQueue.main.async {
self?.objectWillChange.send()
}
}
}

Expand All @@ -65,7 +67,7 @@ public struct SwiftUIPlayer: View, HeadlessPlayer {
self.player = playerValue
self.flow = flow
self.hooks = hooks
self.result = nil
DispatchQueue.main.async { self.result = nil }

for plugin in allPlugins { plugin.apply(player: player) }
registry.partialMatchRegistry = partialMatchPlugin
Expand All @@ -86,7 +88,7 @@ public struct SwiftUIPlayer: View, HeadlessPlayer {

player.start(flow: flow) { [weak self] (result) in
guard let self = self, self.player == playerValue else { return }
self.result = result
DispatchQueue.main.async { self.result = result }
}
}

Expand All @@ -96,7 +98,7 @@ public struct SwiftUIPlayer: View, HeadlessPlayer {
player = nil
hooks = nil
flow = nil
result = nil
DispatchQueue.main.async { self.result = nil }
registry.resetView()
}

Expand Down