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
2
votes
3 answers

SwiftUI - how to make horizontally scrollable views RTL friendly?

I have a SwiftUI app which supports both LTR and RTL languages. It is not fixated to either one of those, it just depends on what user wants. I have a horizontally scrollable list of things inside a vertically scrollable list of things, previously…
Harshad Kale
  • 17,446
  • 7
  • 30
  • 44
2
votes
2 answers

SwiftUI - How to get ScrollView Content Height after once the inside content is changed in Run time

I am able to print scrollview content height based on the below code when the countvalue is static struct ContentView: View { @State var countValue : Int = 1000 var body: some View { ScrollView { ForEach(0..
Maharajan S
  • 93
  • 10
2
votes
0 answers

SwiftUI How to automatically scroll ScrollView with expanding TextField?

I am working on a feature for my app which will allow user to dictate text which will appear in a textField. For that I created a scrollView with only a textField which contents are automatically updating as user is dictating. However I came across…
Mikolaj
  • 56
  • 5
2
votes
0 answers

SwiftUI iOS 14/15 Can't tap Button underneath Spacer in ScrollView

In SwiftUI, I have a Button that's underneath the Spacer within a ScrollView. The ScrollView steals the tap gesture, so the Button never sees the tap. So, for example, the button in this example does not work: struct DoesNotWork: View { var…
drewster
  • 5,460
  • 5
  • 40
  • 50
2
votes
0 answers

SwiftUI Disabling Keyboard Avoidance for item below a ScrollView in a VStack

I'm having some issues surrounding disabling keyboard avoidance in SwiftUI. My app has a custom tab bar which sits in a VStack underneath the content of the root view. However, most of my views have ScrollViews in them. When the keyboard is open it…
jed-boffey
  • 95
  • 1
  • 6
2
votes
0 answers

ScrollViewReader anchor center creates free space

I want to zoom in on a specific element in the scrollview. I want it to be an anchor center. When zooming to the upper left elements, no problem, it works properly. But when you zoom in on the top right and bottom elements, space is created around…
ursan526
  • 485
  • 3
  • 10
2
votes
1 answer

Button click triggers although clicking on button below

I have following code. Two big buttons at the top and a ScrollView with many buttons below: struct ContentView: View { var body: some View { VStack (spacing: 0) { HStack (spacing: 0) { Button(action: {},…
L3n95
  • 1,505
  • 3
  • 25
  • 49
2
votes
2 answers

Placing a rectangle in front of ScrollView affects scrolling

I need to place a translucent rectangle on front of ScrollView but when i put everything (Rectangle & ScrollView) inside of a ZStack, scroll & touch events stop working within this rectangle. Atm I'm using .background modifier as it doesn't affect…
eugene_prg
  • 948
  • 2
  • 12
  • 25
2
votes
1 answer

SwiftUI add border to onSelect horizontal Scrollview image

I tried to make a horizontal scrollview that contained a list of item. when I clicked any of the item, it will show a border(highlight) behind the item. When I press another item, the previous border disappear and the latest clicked item appear the…
Oxford212
  • 89
  • 1
  • 8
2
votes
1 answer

Content offset in ScrollView SwiftUI

I built a simple horizontal calendar with SwiftUI and it works fine. But I want that it automatically scroll to the current date at app launch. How can I do this? I assume I should use GeometryReader to get a position of frame with current date and…
SunnyBunny27
  • 83
  • 2
  • 8
2
votes
1 answer

Issue using ScrollView with Array

I'm trying to use an array to display some game info whenever an array gets updated by a call to a web service. The array is populating fine, but at runtime I get: Generic struct 'ForEachWithIndex' requires that 'Binding<[MatchData]>' conform to…
Gavin Beard
  • 69
  • 1
  • 9
2
votes
1 answer

Scroll Views background colour when placed in a Navigation Stack in SwiftUI

I have two scroll views placed in a NavigationView. I want both the ScrollViews to inherit the colour as mentioned in the onAppear modifier. However, when I navigate to the second ScrollView and go back to the first ScrollView, the first view…
user2580
  • 239
  • 5
  • 13
2
votes
2 answers

Swiftui ObservableObject with array not update view

I have a problem with Array using ObservableObject in my view. I have an empty array. I call a function at page onAppear. When the data is returned, the view does not update with the new data in array: class NewsState: ObservableObject { …
Stefano Toppi
  • 626
  • 10
  • 28
1
vote
0 answers

SwiftUI scrolling header without bounce

I’m trying to accomplish this effect from the Apple News app where the header element scrolls out of the view but when it comes back into view it doesn’t bounce. It sticks to the top while the remainder of the scroll view continues to…
ShaneP
  • 15
  • 1
  • 5
1
vote
0 answers

Preserve scroll position when list changes

I am working on a View that has following requirements: Show list of Sections with "items" in each section. A header with pills that allows filtering the "items" based on different criteria. Some pills may trigger a new API call to fetch…
chow
  • 11
  • 2
1 2
3
8 9