Sunday, October 2, 2022
HomeiOS Developmentios - The best way to put tabs inside a scrollview in...

ios – The best way to put tabs inside a scrollview in SwiftUI?


So mainly I’m very new to SwiftUI(began a number of days in the past) and am making an attempt to place tabs inside a ScrollView. The top outcome I’m making an attempt to realize is that of Instagram’s profile view.

I would think about the view’s implementation can be one thing like this:

    ScrollView {
        VStack {
            HStack {
                // Profile Pic
                // Stats
            }
            // Bio
            // Button(s)
            LazyVStack(pinnedViews: .sectionHeaders) {
                Part {
                    TabView {
                        // Tab 1
                        // Tab 2
                        // Tab 3
                    }
                } headers: {
                      // Tab icons
                }
            }
        }
    }

The issue is, the TabView by no means seems. Additionally I’m not sure whether or not that is the very best setup particularly the LazyVStack as I’m solely utilizing to for the truth that it pins the headers. As I mentioned beforehand, I am tremendous new to SwiftUI so there are definetly some views that I don’t know exist a few of which could be helpful in what I’m making an attempt to realize.

Nonetheless, how can I obtain the format I’m going for?

Thanks!

Facet Query: With the way in which that I’ve the view setup, the scrollbar for the view is for your complete view nonetheless in apps like Instagram, the scrollbars are solely throughout the tabs themselves. How may I additionally incorporate that side into the answer? Thanks once more!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments