Skip to content

Commit fb4df4d

Browse files
Fix build error on older swift versions (#407)
1 parent 23fce24 commit fb4df4d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,16 @@ struct ScrollPositionModifier: ViewModifier {
380380
@Binding var scrollPosition: String?
381381

382382
func body(content: Content) -> some View {
383+
#if swift(>=5.9)
383384
if #available(iOS 17, *) {
384385
content
385386
.scrollPosition(id: $scrollPosition, anchor: .top)
386387
} else {
387388
content
388389
}
390+
#else
391+
content
392+
#endif
389393
}
390394
}
391395

@@ -397,13 +401,17 @@ struct ScrollTargetLayoutModifier: ViewModifier {
397401
if !enabled {
398402
return content
399403
}
404+
#if swift(>=5.9)
400405
if #available(iOS 17, *) {
401406
return content
402407
.scrollTargetLayout(isEnabled: enabled)
403408
.scrollTargetBehavior(.paging)
404409
} else {
405410
return content
406411
}
412+
#else
413+
return content
414+
#endif
407415
}
408416
}
409417

0 commit comments

Comments
 (0)