ios – Bizarre conduct with ScrollView in SwiftUI

0
14
ios – Bizarre conduct with ScrollView in SwiftUI


I’m presently touching up on my SwiftUI data and I am constructing this job display screen. Nonetheless there may be this bizarre part with the ScrollView that I can not clarify on the way to take away (grey space above tab bar on first screenshot). It appears to vanish when absolutely scrolled to the underside of the app.

Be aware: I’ve a customized TabBar and in my ContentView the entire Views are in a ZStack

struct DailyTaskView: View {
    var duties: [Task]
    
    var physique: some View {
        ZStack {
            Shade.gBlack.ignoresSafeArea(.all)
            
            ScrollView(.vertical, showsIndicators: false) {
                VStack {
                    ForEach(duties) { job in
                        TaskItemView(job: job)
                            .padding(.vertical, 10)
                    }
                }
            }
        }
    }
}
struct TaskItemView: View {
    var job: Job
    
    var physique: some View {
        HStack(alignment: .heart, spacing: 40) {
            Circle()
                .body(width: 10, peak: 10)
                .foregroundColor(.white)
                .shadow(coloration: .white.opacity(0.1), radius: 3)
            
            VStack(alignment: .main, spacing: 8) {
                HStack(spacing: 8) {
                    Textual content(job.title)
                        .foregroundStyle(Shade.white)
                        .font(.title)
                    
                    Spacer()
                    
                    Label("11:22 PM", systemImage: "clock")
                        .foregroundStyle(Shade.white)
                }
                
                Textual content(job.description)
                    .foregroundStyle(Shade.white)
                    .font(.callout)
            }
//            .body(maxWidth: .infinity)
            .padding(15)
            .background(job.tint, in: .rect(topLeadingRadius: 15, bottomLeadingRadius: 15))
//            .clipShape(.rect(cornerRadius: 20))
            .strikethrough(job.isCompleted, sample: .stable, coloration: .white)
        }
        .padding(.main)
    }
}
struct ContentView: View {
    @State personal var tabSelection: Int = 0
    @State personal var duties: [Task] = sampleTask.sorted(by: {$1.date > $0.date})
    
    var physique: some View {
        
        ZStack {
            Shade.gBlack.ignoresSafeArea(.all)
            
            VStack() {
                DateHeaderView()
                    .body(maxWidth: .infinity)
                    .background(Shade(Shade.gBlack))
                
                TabView(choice: $tabSelection) {
                    DailyTaskView(duties: duties)
                        .tag(0)
                    Textual content("Tab 2")
                        .foregroundStyle(Shade.gBlack)
                        .font(.largeTitle)
                        .fontWeight(.black)
                        .tag(1)
                    
                }
                
                Spacer()
                
                TabBarView(tabSelection: $tabSelection)
            }
            .ignoresSafeArea(edges: .backside)
        }
    }
}

Top of ScrollView
Bottom of ScrollView

Tried changing to Listing to see if it was ScrollView particular

Performed with .body() with no luck

Verified there wasn’t any extra padding that might intervene

LEAVE A REPLY

Please enter your comment!
Please enter your name here