@@ -118,8 +118,8 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
118
118
try await prev. last? . coordinator. disconnect ( )
119
119
let liveChannel = try ! await self . liveSocket!. joinLiveviewChannel (
120
120
. some( [
121
- " _format " : . str( string: Self . platform) ,
122
- " _interface " : Self . platformParams
121
+ " _format " : . str( string: LiveSessionParameters . platform) ,
122
+ " _interface " : . object ( object : LiveSessionParameters . platformParams)
123
123
] ) ,
124
124
next. last!. url. absoluteString
125
125
)
@@ -130,8 +130,8 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
130
130
try await prev. last? . coordinator. disconnect ( )
131
131
let liveChannel = try ! await self . liveSocket!. joinLiveviewChannel (
132
132
. some( [
133
- " _format " : . str( string: Self . platform) ,
134
- " _interface " : Self . platformParams
133
+ " _format " : . str( string: LiveSessionParameters . platform) ,
134
+ " _interface " : . object ( object : LiveSessionParameters . platformParams)
135
135
] ) ,
136
136
next. last!. url. absoluteString
137
137
)
@@ -195,15 +195,15 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
195
195
let liveChannel = try ! await self . liveSocket!. joinLiveviewChannel (
196
196
. some( [
197
197
" _format " : . str( string: LiveSessionParameters . platform) ,
198
- " _interface " : LiveSessionParameters . platformParams
198
+ " _interface " : . object ( object : LiveSessionParameters . platformParams)
199
199
] ) ,
200
200
nil
201
201
)
202
202
203
203
self . rootLayout = self . liveSocket!. deadRender ( )
204
204
let styleURLs = self . liveSocket!. styleUrls ( )
205
205
206
- self . stylesheet = try ! await withThrowingTaskGroup ( of: Stylesheet< R> . self ) { group in
206
+ self . stylesheet = try ! await withThrowingTaskGroup ( of: Stylesheet< R> . self ) { @ Sendable group in
207
207
for style in styleURLs {
208
208
guard let url = await URL ( string: style, relativeTo: self . url)
209
209
else { continue }
@@ -216,7 +216,7 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
216
216
}
217
217
218
218
return try await group. reduce ( Stylesheet < R > ( content: [ ] , classes: [ : ] ) ) { result, next in
219
- return result. merge ( with: next)
219
+ return await result. merge ( with: next)
220
220
}
221
221
}
222
222
@@ -233,7 +233,7 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
233
233
func bindLiveReloadListener( ) {
234
234
let eventListener = self . liveReloadChannel!. channel ( ) . eventStream ( )
235
235
self . liveReloadListener = eventListener
236
- self . liveReloadListenerLoop = Task { [ weak self] in
236
+ self . liveReloadListenerLoop = Task { @ MainActor [ weak self] in
237
237
for try await event in eventListener {
238
238
guard let self else { return }
239
239
switch event. event {
@@ -349,8 +349,8 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
349
349
@MainActor
350
350
enum LiveSessionParameters {
351
351
static var platform : String { " swiftui " }
352
- static var platformParams : LiveViewNativeCore . Json {
353
- . object ( object : [
352
+ static var platformParams : [ String : LiveViewNativeCore . Json ] {
353
+ [
354
354
" app_version " : . str( string: getAppVersion ( ) ) ,
355
355
" app_build " : . str( string: getAppBuild ( ) ) ,
356
356
" bundle_id " : . str( string: getBundleID ( ) ) ,
@@ -359,7 +359,7 @@ enum LiveSessionParameters {
359
359
" target " : . str( string: getTarget ( ) ) ,
360
360
" l10n " : getLocalization ( ) ,
361
361
" i18n " : getInternationalization ( )
362
- ] )
362
+ ]
363
363
}
364
364
365
365
private static func getAppVersion( ) -> String {
@@ -454,11 +454,11 @@ enum LiveSessionParameters {
454
454
/// Create a nested structure of query items.
455
455
///
456
456
/// `_root[key][nested_key]=value`
457
- func queryParameters( for object: [ String : Any ] ) -> [ ( name: String , value: String ? ) ] {
457
+ func queryParameters( for object: [ String : Json ] ) -> [ ( name: String , value: String ? ) ] {
458
458
object. reduce ( into: [ ( name: String, value: String? ) ] ( ) ) { ( result, pair) in
459
459
if let value = pair. value as? String {
460
460
result. append ( ( name: " [ \( pair. key) ] " , value: value) )
461
- } else if let nested = pair. value as? [ String : Any ] {
461
+ } else if case let . object ( nested) = pair. value {
462
462
result. append ( contentsOf: queryParameters ( for: nested) . map {
463
463
return ( name: " [ \( pair. key) ] \( $0. name) " , value: $0. value)
464
464
} )
0 commit comments