Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Eliminates some UI elements if inside VStacks #19

Description

@IZ-Labs

This is a bit of a weird one an potentially not iPages related. I'm curious if you can recreate this issue.

I was using the default apple PageTabViewStyle but saw this library and gave it a shot. My app has buttons that show up based on if statements. This worked fine with PagesTabView, but upon adding iPages, the buttons inside if statements disappear. If I remove the if statement the buttons pop back up.

Not quite sure what the issue is. I've attached my ContentView.swift file below, with most of my code removed for clarity.

`
import SwiftUI
import HealthKit
import HealthKitUI
import iPages

class SummaryHolder: ObservableObject {
@published var theSummary: HKActivitySummary = HKActivitySummary();
}

struct ContentView: View {
var body: some View {
iPages{
ZStack{
LinearGradient(gradient: Gradient(colors: [.black, Color("darkBlue")]),
startPoint: .topLeading,
endPoint: .bottomTrailing).ignoresSafeArea()
VStack {
VStack {
if movePercent >= 50 {
Button(action: /@START_MENU_TOKEN@//@Placeholder=Action@/{}/@END_MENU_TOKEN@/) {
DispenseButton(title: "One Spin",
textColor: .blue,
backgroundColor: .white)
}
}

                if movePercent >= 75 {
                Button(action: /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Action@*/{}/*@END_MENU_TOKEN@*/) {
                    DispenseButton(title: "Two Spins",
                                   textColor: .blue,
                                   backgroundColor: .white)
                }
                }
                
                if movePercent >= 100 {
                Button(action: /*@START_MENU_TOKEN@*//*@PLACEHOLDER=Action@*/{}/*@END_MENU_TOKEN@*/) {
                    DispenseButton(title: "Three Spins",
                                   textColor: .blue,
                                   backgroundColor: .white)
                }
                }
                
                if movePercent < 50 {
                    Image(systemName: "exclamationmark.triangle.fill") .renderingMode(.original)
                        .resizable()
                        .aspectRatio(contentMode: .fit)
                        .frame(width: 180, height: 180, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
                    
                    Text("Get moving and try again later").font(.system(size: 20, weight: .bold, design: .default))
                        .foregroundColor(.white)
                        .padding().multilineTextAlignment(.center)
                }
            }
            Spacer()
        }
    }
        Text("Add Bluetooth Menu here").tabItem {
                Image(systemName: (selected == 0 ? "sun.fill" : "sun"))
                Text("Home")
            }
    }.hideDots(false).edgesIgnoringSafeArea(.all)
}

}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
}
}
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions