Skip to content

Commit

Permalink
Fix build error on older swift versions (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple authored Dec 11, 2023
1 parent 23fce24 commit fb4df4d
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -397,13 +401,17 @@ struct ScrollTargetLayoutModifier: ViewModifier {
if !enabled {
return content
}
#if swift(>=5.9)
if #available(iOS 17, *) {
return content
.scrollTargetLayout(isEnabled: enabled)
.scrollTargetBehavior(.paging)
} else {
return content
}
#else
return content
#endif
}
}

Expand Down

0 comments on commit fb4df4d

Please sign in to comment.