Ok So I want to create the horizontal scroll and vertical scroll like this:
https://youtu.be/8VciE9Qxe9k
To create that I put the header with the day number and the content of each day in a horizontal scroll view and the coontent of the days in a vertical scroll View like this:
The problem with that layout is that the lateralhours on the side have to move to. So what I do is I track the position of the vertical scroll view using:
.background( GeometryReader {
Color.clear.preference(key: ScrollOffsetPreferenceKey.self,
value: -$0.frame(in: .named("scroll")).origin.y)
})
.onPreferenceChange(ScrollOffsetPreferenceKey.self) { value in
offset = value
}
And with that position I use .offset to "scroll" the lateralhours.
It works but it's laggy and it's slowing down my app I wanted to know if someone had an other solution maybe a better way than using .offset
Post
Replies
Boosts
Views
Activity
Anyone knows how to implement this scroll layout ?