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
1
vote
1 answer

SwiftUI: Adjust bounds of ScrollView

I am trying to scale a view horizontally using scaleEffect and MagnificationGesture. It is almost working as I want with the exception that the ScrollView does not resize when its child view resizes. Is there a fix for this? Any solution would be…
Isaak
  • 1,107
  • 2
  • 11
  • 29
1
vote
1 answer

SwiftUI How can I center content in a dynamic horizontal scroll view when the total content width is less than screen width

I have a horizontal scrollView which shows a bunch of images from a dynamic image array. When the total content width is greater than the screen width everything is fine. However if say there is only one image in the array, it will be leading…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
1 answer

SwiftUI set max height on ScrollView

I have built a Chips Container based on this link. Basically is just a container that orders chips in rows. This is my code: struct ChipsContent: View { @ObservedObject var viewModel = ChipsViewModel() @State private var totalHeight …
Dani Garcia
  • 464
  • 1
  • 6
  • 18
1
vote
2 answers

How to build scrollable side menu using text rotation (or something similar) in SwiftUI?

I want to build a menu like the image bellow where I can scroll between menus. I did try multiple combinations with HStack/VStack in ScrollView and rotation modifier on Text and/or stacks. However, none of my attempts really works as…
Hans Rietmann
  • 396
  • 5
  • 13
1
vote
1 answer

How do I fix buttons not being tappable in a ForEach loop?

I have a view which contains a button. The view with the button is created from a forEach loop. For some reason only some buttons are tappable and others are not. The parent view contains a NavigationView, a scroll view inside the NavigationView, a…
Taylor Simpson
  • 940
  • 1
  • 10
  • 27
1
vote
1 answer

Swiftui ScrollViewreader multiple ScrollTo in different Foreach

I can't make many .scrollTo() in my code: (I'm French sorry for my bad english) else if index == 1 { withAnimation { value.scrollTo(topID) } } my issue is in value.scrollTo(topID) I tried to implement 6 of them in 3 differents…
Name
  • 11
  • 1
1
vote
1 answer

SwiftUI tap under scrollview

Tap gesture on green does not work. Does anyone have a solution for this? ZStack { Color.green .onTapGesture { print("green") } ScrollView { VStack { Spacer(minLength: 500) …
NikaE
  • 614
  • 1
  • 8
  • 15
1
vote
1 answer

In SwiftUI, how to scale content inside scrollView with dynamic changing scrolling area?

I'm developing MacOS App with SwiftUI. Let's say we have a fixed size window, which will show a scrollable image. Now I want to create a feature which can let user to scale the image, and can scroll and view the scaled image inside the window. The…
Yuqi Jin
  • 43
  • 6
1
vote
0 answers

Nested ForEach + ScrollView Header causes Glitches

Inside of a Scrollview I use a LazyVStack with a pinned header, and based on the scroll position I manipulate the scale of that header. In the LazyVStack, I have a ForEach iterating over some list of items. However, if I use a nested ForEach loop…
bze12
  • 727
  • 8
  • 20
1
vote
1 answer

NavigationLink inside LazyVGrid is not displayed correctly in swiftUI macOS

I am developing a cross platform app in SwifUI. On iPhone / iPad this code works really well on MacOS instead when I insert a NavigationLink the ForecastCardView is totally cut off. When I remove the NavigationLink everything is rendered…
1
vote
0 answers

Swiftui: check if content fits scrollview without scrolling

I wonder how to determine if the content inside ScrollView is fully visible without scrolling? ScrollView { LazyVStack { PlainButton("1") PlainButton("2") PlainButton("3") PlainButton("4") PlainButton("5") PlainButton("6") …
eugene_prg
  • 948
  • 2
  • 12
  • 25
1
vote
0 answers

SwiftUI macOS ScrollView crashes when HStack spacing is negative

I am using the following code to create a horizontal scroll view with negative spacing (I'm using negative spacing so the items in the stack overlap). Whenever my app is in a small window and I interact with the scroll view's slider, the app crashes…
Evan Kaminsky
  • 695
  • 10
  • 23
1
vote
1 answer

Block scroll down in ScrollView - SwiftUI

How can I block scroll down and only allow scroll up in order to avoid seeing the white space over the rectangle on top when scrolling? struct ContentView: View { var body: some View { GeometryReader { geo in ScrollView…
xmetal
  • 681
  • 6
  • 16
0
votes
0 answers

Problem with ScrollView in scroll offset IOS 17

I have a problem with the SwiftUI component in the beta version of iOS 17. In iOS 16, the "parallaxedView" element would stretch its height when scrolling to the top of the screen, and upon releasing the finger, the height would return to its…
0
votes
0 answers

I am Using LazyHGrid / LazyHStack inside Custom ScrollView(UIScrollView), but lazy nature is not working

Can anybody tell me how can i set offset in a ScrollView?I have checked ScrollTo(), which scroll to index wise. But I want to move scrollview with offset. I have also checked Custom ScrollView( from UIScrollView) which can be used to set and get…
1 2 3
8 9