Questions tagged [swiftui-scrollview]

For questions about ScrollView - a view in Apple's SwiftUI framework that is scrollable. When using this tag also include the more generic [swiftui] tag where possible.

Links:

127 questions
3
votes
1 answer

How do I modify the background color and shape of drag&drop preview SwiftUI?

I'm trying to implement simple list with draggable cells (iOS 15). For now I have two base solutions: List and ScrollView. None of this methods doesn't lead me to appropriate result. First of all I'll provide some code: List item view: struct…
agoncharov
  • 822
  • 1
  • 6
  • 15
3
votes
0 answers

SwiftUI 2.0 Keyboard Avoidance set ScrollBar offset

I'd like to change the ScrollBar offset when tapping on a TextField in a ScrollBar which is located at the bottom (so keyboard avoidance will trigger). When I select a TextField, the ScrollBar adjusts. But the bottom part of the TextField (the gray…
leonboe1
  • 1,004
  • 9
  • 27
3
votes
0 answers

SwiftUI Calendar on scroll get current month

Im trying to get the current month when the calendar is being scrolled. My goal is to have the header with the current month, then when the view is scrolled down to a new month the header updates with the corresponding month. I tried using a…
Carterman
  • 219
  • 1
  • 7
2
votes
1 answer

How to achieve the fade plus sticky header screen effect in SwiftUI

I would like to achieve attached gif effect in swiftUI, i have tried to make use of several ways to get it to work with no success. When scrolling up the buttons must fade and then once the switcher tab gets to the navbar it should become sticky and…
kaddie
  • 233
  • 1
  • 5
  • 27
2
votes
2 answers

SwiftUI: ScrollView pagingEnabled no longer working on iOS 16.4

On iOS 16.3 the ScrollView component can enable paging by setting the following: UIScrollView.appearance().isPagingEnabled = true However, after updating to iOS 16.4, this no longer enables paging on the ScrollView. Are there any workarounds to…
John
  • 188
  • 1
  • 3
  • 10
2
votes
1 answer

SwiftUI ScrollView: keep view anchored to bottom when resizing view

I am building a chat application with SwiftUI. I am fetching my chat list through Firestore and create the scrollview and insert an empty Stack under the messages as an anchorpoint to which the scrollview is scrolling whenever the message count…
Casualzach
  • 38
  • 5
2
votes
0 answers

SwiftUI LazyVGrid EXC_BREAKPOINT when scrolling after GridItem size change

I want a SwiftUI LazyGrid that can change its GridItem size with an animation, but a crash occurs while scrolling up after the size is made smaller. Steps to Reproduce: 1 - scroll to bottom of 'xLarge' size grid 2 - change to 'large' size using…
teaseaque
  • 280
  • 2
  • 6
2
votes
1 answer

SwiftUI ScrollView gesture recogniser

How can I detect when a ScrollView is being dragged? Within my ScrollView I have an @Binding scrollPositionOffset variable that I watch with .onChange(of:) and then programmatically scroll to that position using ScrollViewReader.scrollTo(). This…
2
votes
1 answer

SwiftUI - ScrollView not showing bottom Texts

So i am trying to show a bunch to Texts in scrollView yet to bottom once not showing(they are in size of tableView line). this is my code: struct TestView: View { @ObservedObject var viewModel: ViewModel @State private var contentSize: CGSize =…
ironRoei
  • 2,049
  • 24
  • 45
2
votes
0 answers

Get first visible view (item) inside a ScrollView that stores a LazyVStack

I have a ScrollView that will support infinite scroll (it’s a calendar), and so I’m using a LazyVStack for its contents. I need to know at all times what the first visible item is. To be clear, as long as any of the view is visible — however slight…
Barrrdi
  • 902
  • 13
  • 33
2
votes
0 answers

Disable scrolling when adding elements at the beginning of an array

When ScrollView is initialized, the focus is on item number 6. When I do insert, the focus element is lower. How can I make ScrollView not change the focus on the element? I want the focus to still remain on element 6 when inserting. That is, so…
Clockdev
  • 21
  • 2
2
votes
2 answers

SwiftUI: Pin headers in scrollview which has vertical and horizontal scroll in excel like view

I created an excel-like view, using a multi-directional scroll view. Now I want to pin the headers, not only the column headers but the row headers as well. Look at the following gif: Code I used to create this view: ScrollView([.vertical,…
Parag Pawar
  • 827
  • 3
  • 12
  • 23
2
votes
1 answer

SwiftUI dragging ScrollView flickers as the keyboard is dismissing

When I develop the feature that allows users drag ScrollView to dismiss keyboard in SwiftUI, I find that if you drag ScrollView as the keyboard is dismissing, the ScrollView will flicker. That will destroy the experience of the feature. Here's the…
2
votes
0 answers

SwiftUI: Infinite, lazy, scrollable view that shows arbitrary cell on appearance

thank you for helping me with the following issue. The Overall Goal I work on a SwiftUI view that contains a scrollable area to present some data. Assume it should display natural numbers within a certain bound, for example, 0 to 2,000,000. Each…
2
votes
1 answer

swiftui ScrollViewReader scrollTo not correct working

I am developing an application with swiftui. After zooming, when I say scroll to the corner with the ScrollViewReader, it goes out of the screen. my code is below. It fails after trying a few times. it doesn't do it every time. import…
ursan526
  • 485
  • 3
  • 10
1
2
3
8 9