ios – How to make lists in a TabView scroll with the main ScrollView in SwiftUI?


So basically I have a view whose structure looks like this:

ScrollView {
    VStack {
        VStack {...}
        TabView {
            ScrollView(.vertical, showsIndicators: false) {
                ForEach(1...300, id: \.self) { index in
                    Text("\(text) \(index)")
                        .frame(maxWidth: .infinity, minHeight: 50)
            // Other placeholder tabs

The issue with this is that the main ScrollView and the ScrollView within the tabview are separate and therefore scroll independent of one another. What I’d ultimately like to achieve is the profile layout like TikTok where the main ScrollView and the content of the TabView scroll together however I cannot figure out how because I’m new to SwiftUI.

Thank you!