209 questions
0
votes
0
answers
38
views
SwiftUI .refreshable causes misaligned button tap targets in ScrollView
I have a ScrollView with several Buttons and a .refreshable modifier. As soon as I pull to refresh and the refresh indicator appears, the tap targets no longer match the visible button positions. For ...
0
votes
1
answer
56
views
SwiftUI ScrollView scrollPosition not updating on autoscroll
The following code fails to update scrollPosition in SwiftUI ScrollView when the user auto-scrolls, i.e. swipes the finger to scroll and picks up the finger immediately. While the scroll view ...
0
votes
1
answer
85
views
How to make a Button work inside a ScrollView but outside of the ScrollView's bounds in SwiftUI?
I observed a weird behavior and I believe it's a bug in SwiftUI but maybe it's not or someone knows a way to fix it.
By default, overlays have the same size as the view they are attached to in SwiftUI....
1
vote
1
answer
121
views
SwiftUI programmatic scrolling misses on frequent updates to value
I have the following code of a scrolling scrubber. Problem is programatic scrolling either on startup ('onAppear') does not work, and even in the middle it is unpredictable where sometimes it works ...
0
votes
1
answer
51
views
How to use a button to change the position of ForEach generated views using ScrollView and the .scrollPosition modifier [closed]
I'm trying to create a paginated text element that loads strings from a simple array (of unknown range), which can be navigated through using a 'next' button.
Think of character dialogue boxes in old-...
1
vote
1
answer
96
views
Collapsible header hides after pull-down gesture
I’m trying to implement a collapsible header in SwiftUI that collapses when the user scrolls down and expands when the user scrolls up.
I followed this Medium post: Collapsible Header in SwiftUI
The ...
1
vote
1
answer
131
views
How to synchronize the scroll position between two repeating, scrollable views?
I am trying to recreate this view from an app. essentially its two repeating/infinite scrollable views. the top contains the days of the week, and the bottom is a paging view that shows the classes on ...
1
vote
1
answer
81
views
SwiftUI ScrollPosition and viewAligned behavior
I have a discrete scrubber implementation using ScrollView in SwiftUI that works but fails in the end points sometimes. For instance, scrolling it all the way to bottom shows a value of 87 instead of ...
3
votes
5
answers
2k
views
ScrollViews at the bottom of NavigationStack cause the navigation title to be invisible in iOS 26
I have a NavigationStack that contains a ScrollView at the bottom of the screen.
struct ContentView: View {
var body: some View {
NavigationStack {
VStack {
...
0
votes
0
answers
31
views
SwiftUI Horizontal Scroll of columns with max width and adjusted height
I’m working on a kanban-style app with a horizontal scroll view of columns representing different states. Each column contains some text elements. I want the columns to adjust their width based on the ...
0
votes
0
answers
69
views
Form Items inside scrollview randomly stops being clickable
I need view like this in order to have fixed size form with scrollable capability.
I have disclosure groups, buttons and textfields inside form.
struct ContentView: View {
var body: some View {
...
0
votes
0
answers
96
views
How to maintain scroll position across tabs and rotation in SwiftUI?
I have a view called SurahView. In this view, I need 2 modes: translation and reading.
In the translation mode, I have a series of verses with both the Arabic text and English text for each verse.
In ...
0
votes
1
answer
84
views
Scrollable list items flicker when keyboard is dimissed
In code below, when the list has more items than can fit on the screen, when the keyboard is dismissed the list items flicker, appear jittery. I have not been able to find a solution. I suspect ...
0
votes
1
answer
134
views
Update zIndex based on scroll position in ScrollView
This code shows a cover-flow-style view where you can scroll through the images in a Scroll View, while the images itself come from an array. The spacing is -100 to let the other pictures not in the ...
0
votes
2
answers
232
views
SwiftUI ScrollView scrollTargetLayout not working
I have the following scrubber implementation in SwiftUI. The + button is supposed to move the ScrollView up by 1 tick (or scrollPosition incremented by 1) but the issue is no scrolling happens until I ...
1
vote
0
answers
98
views
SwiftUI ScrollView Custom Canvas Component Issues
I'm trying to replicate Apple's Freeform app's canvas view in SwiftUI. I have tried approaching this from every side but it feels like I'm fighting the framework instead of working with it. Here's ...
1
vote
1
answer
80
views
List cannot scroll vertically If hovered a List subview that needs to support horizontal scrolling
I have a List that contains some views, some of which need horizontal scrolling. It is important to note that none of the views require vertical scrolling. When my mouse hovers over the views that do ...
7
votes
5
answers
580
views
How can I scale the height of child items with a magnify gesture while preserving the scroll position in a SwiftUI ScrollView?
I am trying to create a day calendar view, similar to the iOS calendar app. There is a feature on the app where you can pinch the calendar to change the distance between hours, which I am trying to ...
0
votes
3
answers
157
views
How to round the corners of a ScrollView without affecting indicators?
In my code, I want the indicators to not have a background but still be included in my UI. Therefore, I want this layout, but it has an issue—I cannot clip the ScrollView to remove those four extra ...
0
votes
2
answers
376
views
SwiftUI scrollTo function stops working if I also use onScrollVisibilityChange with custom id tag
SwiftUI's scroll behavior is vexing.
So, using iOS 18 newest APIs...
If I use a custom id tag and scrollTo on its own, it works fine (actually not fine, it often scrolls to the wrong place with ...
1
vote
0
answers
64
views
TabView views only show when I remove the ScrollView. But I need the ScrollView for my complex UI, so how do I fix this?
TabView views only show when I remove the ScrollView. But I need the ScrollView for my complex UI, so how do I fix this?
ScrollView {
VStack {
if showDivider {
Divider(...
0
votes
0
answers
74
views
strange line when putting scrollview inside of NavigationView- SwiftUI MacOS
If i have the following code in a SwiftUI view:
NavigationView {
NavigationLink(destination: ScrollView{}, label: {
Text("Thing")
})
}
It creates this ...
0
votes
1
answer
419
views
Get optimized ScrollView value IOS
I need to get the ScrollView value, and I already have one solution, but it's not very optimized. And I have a strong feeling that I'm missing a simpler solution. My final goal is get the ScrollView ...
1
vote
1
answer
308
views
Compose Multiplatform Composable View not scrolling in IOS Scroll view when scrolled from Composable View
I integrated a composable view into my Compose Multiplatform project and embedded it within an iOS UIScrollView. I expected the scroll view to function as intended, allowing smooth vertical or ...
3
votes
1
answer
4k
views
SwiftUI scrollview sticky header without using List
I've been fighting with GeometryReader and .onChange(of: geo.frame(in: .global).minY) for a long time trying to get this to work with no great success. Consider the following:
struct TestScreen: View {...
0
votes
0
answers
83
views
How to implement Snapchat-style circular image carousel with ScrollView?
Swift Beginner, I want to achieve a scrolling effect similar to Snapchats filter changer.
It's a static circlestroke with round images you can drag into it. Here's a Screenshot.
I'm using a horizontal ...
1
vote
0
answers
142
views
No tap animation when pressing a Button inside a ScrollView with SwiftUI
I am writing an application and have a structure similar to the following:
ScrollView {
VStack {
Button(action: {
print("hello")
}) {
Text("...
0
votes
1
answer
331
views
Make rows of SwiftUI Grid 'scrollable'
I have SwiftUI grid of 25 rows with a first header row and a totals row at the bottom. I would like the header and the totals row to remain fixed, but allow the user to scroll the 23 rows (as they ...
0
votes
0
answers
61
views
Prevent or detect scrolling by dragging of scroll indicator
In our app, we display a large list of items (roughly 30000 items) whereby each item needs to convert a complex/long string with tags into a NSAttributedString which is then displayed. We have ...
6
votes
5
answers
1k
views
Disable Interactive Dismissal of Navigation Transitions in SwiftUI
I am using the new navigationTransitionStyle(.zoom(id, namespace)) to zoom from a view preview to a detail view in my swiftUI app.
My issue is that I have a snapping scrollView in the detail view, ...
2
votes
4
answers
3k
views
Preserve Scroll Position in ScrollView when Adding New Items
I am currently struggling on my ChatView of my app. This is a sample code of what i want to achieve. It has functionality such as when the user is about to reach the top it fetches older messages and ...
0
votes
0
answers
37
views
How to create a dynamic dual-background in a parent view based on a child ScrollView's Y offset in SwiftUI?
I've built a CustomScrollView in SwiftUI that accepts a topContent: View and bottomContent: View, and reports the Y offset along with the frame height of the topContent. Here's my implementation::
...
0
votes
0
answers
143
views
Issues with displaying Images in SwiftUI
I have an issue with loading Images from SwiftData or from Disk (Directory Folder) into a SwiftUI View.
In the below example is the ScrollView with the LazyVGrid loading Images from SwiftData - (...
14
votes
3
answers
6k
views
ScrollView not working when DragGesture is enabled in subview
Ever since Xcode 16, whenever there is a subview with a horizontal DragGesture inside a vertical ScrollView, horizontal drag gesture is detected on the subview but any scrolling up/down is not ...
0
votes
0
answers
71
views
Dynamic resizing within ScrollView with limited maxWidth and maxHeight for one component and flexible for another?
I'm working with a vertical ScrollView in SwiftUI, and I want to have dynamic resizing for two components inside it. Specifically, I want one component to have a constrained maxWidth and maxHeight (up ...
-1
votes
1
answer
88
views
State transition in SwiftUI by scrolling in onAppear can be lost
If you use the onAppear method to scroll to a SwiftUI view with the help of a ScrollViewProxy, this can lead to the loss of the state transition in the view when using published values of an ...
1
vote
2
answers
213
views
Swiftui Bug - Button (only top part is clickable)
I'm having an issue with SwiftUI where only the top part of the button is clickable, while the bottom part is not clickable at all.
Here is my code snippet. Does anyone know how I can fix this?
struct ...
0
votes
0
answers
75
views
SwiftUI Spline 3d model inside of ScrollView
I'm a beginner to Swift and SwiftUI and I am building a side-project. I am attempting to load an interactive 3d model (fetching from Spline Cloud link) into a ScrollView, but the gestures with the 3d ...
4
votes
2
answers
3k
views
ScrollView takes the entire height when content is small
I'm new to Swift UI and I'm having troubles to make a specific UI behave the way I want.
I have a ScrollView that has some content. This content in a VStack can be as small as 1-3 text components to ...
9
votes
2
answers
2k
views
SwiftUI viewAligned scrollTargetBehavior for ScrollView where scrollTargetLayout subviews are irregular in size
I'm trying to use SwiftUI's viewAligned scrollTargetBehavior for a ScrollView where scrollTargetLayout subviews are irregular in size.
Here's an example, which I've simplified for the purpose of ...
1
vote
2
answers
1k
views
How can I make elements appear at the bottom of a ScrollView?
I have a SwiftUI related question. I'm trying to make a chat and make messages appear at the bottom of the screen (like at the screen from Telegram). All solutions I tried keep rendering messages at ...
1
vote
2
answers
126
views
How does scrollIndicatorsFlash(trigger value: some Equatable) not require a binding to observe changes?
I'm learning about Lists and ScrollViews in SwiftUI and one of the modifiers that is available is:
public func scrollIndicatorsFlash(trigger value: some Equatable) -> some View
Documentation
My ...
0
votes
1
answer
232
views
Scroll jump in SwiftUI when using two LazyVGrids in a single ScrollView
In my project I have two LazyVGrids inside the same ScrollView, which are dynamically loading content: pages of the first grid are requested every time the user is reaching the end, and when all the ...
2
votes
1
answer
84
views
SwiftUI enable scrolling of List inside a disabled ScrollView
I have a List inside a ScrollView that is scroll disabled. The List also disables and cannot be enabled. I need the ScrollView to not scroll by drag gesture. Is there a way to allow the List to scroll ...
0
votes
0
answers
222
views
NavigationStack crashes when poping scrolling view on iOS 16
Investigating strange navigation bug in my iOS app.
I'm using NavigationStack for push-navigation and a dedicated ObservableObject Communicator which holds current NavigationStack's path.
What I want ...
2
votes
0
answers
797
views
Is it possible to loop a SwiftUI ScrollView to repeat infinitely?
I have a horizontal scroll view and a fixed array. I would like to loop it such that when I scroll left and get near the end, the array will add the items in the beginning to the end so that the user ...
0
votes
2
answers
1k
views
SwiftUI - Allow List to Show All Rows in ScrollView
In the app I'm working on I have a details view that uses ScrollView to display a bunch of information. I want to use a List inside that ScrollView to display some specific data. However, you can't ...
1
vote
1
answer
296
views
SwiftUI ScrollViewReader scrollTo doesn't scroll all the way to top
I want the ScrollView to scroll to top when I tap on the tab. It works but it stops parallel to the navigation title and doesn't scroll all the way below the title as expected.
The current behaviour ...
0
votes
0
answers
397
views
SwiftUI ScrollView has weird behavior when reseting the content
I'm working with SwiftUI and trying to do a ScrollView that can be filtered (it's basically a list).
The stack looks like this:
class ViewModel: ObservableObject {
@Published
var isRefreshing =...
1
vote
0
answers
217
views
How do I write my own SwiftUI ScrollView that will respect a lazy subview?
I am trying to write my own MyScrollView to manage scroll. I am doing this because I want to have a LazyVStack with items that have varying heights and for which I can scroll to any item inside. So, ...