From e41d158f0e483912883c020b5ca3d48359d88146 Mon Sep 17 00:00:00 2001 From: Alexey Alter-Pesotskiy Date: Mon, 11 Dec 2023 12:19:16 +0000 Subject: [PATCH] Fix build error on older swift versions --- .../ChatChannel/MessageList/MessageListView.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift index b3bee36d..fc3a4098 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift @@ -380,12 +380,16 @@ struct ScrollPositionModifier: ViewModifier { @Binding var scrollPosition: String? func body(content: Content) -> some View { + #if swift(>=5.9) if #available(iOS 17, *) { content .scrollPosition(id: $scrollPosition, anchor: .top) } else { content } + #else + content + #endif } } @@ -397,6 +401,7 @@ struct ScrollTargetLayoutModifier: ViewModifier { if !enabled { return content } + #if swift(>=5.9) if #available(iOS 17, *) { return content .scrollTargetLayout(isEnabled: enabled) @@ -404,6 +409,9 @@ struct ScrollTargetLayoutModifier: ViewModifier { } else { return content } + #else + return content + #endif } }