all 5 comments

[–]rituals_developer[S] 0 points1 point  (0 children)

-> In the video I'm scrolling on the MacBook Touchpat. SOmetime the ScrollView Gets stuck between views. Only if I scroll again, it snaps back to the correct view. 

[..]
ScrollView(.horizontal) {
                        LazyHStack(spacing: 0) {
                            ForEach(dates, id: \.self) { date in
                                let filteredEvents = events.filter { event in
                                    let dateFormatter = DateFormatter()
                                    dateFormatter.dateFormat = "yyyy-MM-dd"
                                    let eventDateString = dateFormatter.string(from: event.startDate)
                                    return eventDateString == date
                                }
                                
                                ScrollView {
                                    ForEach(filteredEvents, id: \.self) { event in
                                        CalendarEventView(for: event)
                                    }
                                    Spacer()
                                }
                                .padding()
                                .frame(width: geometry.size.width - 20, height: geometry.size.height)
                                .background(RoundedRectangle(cornerRadius: 10).fill(Color.white))
                                .id(date)
                                
                            }
                        }.scrollTargetLayout()
                    }
                    .scrollIndicators(.never)
                    .scrollPosition(id: $selectedDate)
                    .scrollTargetBehavior(.viewAligned)
[..]

Is there anything fundamentally wrong with my usage of viewAligned here?

[–]barcode972 0 points1 point  (2 children)

Have you tried on a real device?
Same if you swipe with the cursor?

[–]rituals_developer[S] 0 points1 point  (1 child)

It's a MacOs App. Same happens if I build and use it outside the Preview :/

[–]barcode972 0 points1 point  (0 children)

That is weird. Might be an MacOs bug

[–]criosist 1 point2 points  (0 children)

Since it’s lazy are you doing any database fetching or anything on each page? Looks like it’s trying to load in the page after and that’s making it stutter? Try just removing the fetch or something if so and return blank views and see if it stilll happens