Open IZ-Labs opened 3 years ago
Yeah this is a problem with iPages. This code doesn't work:
struct ContentView: View {
@State var displayButton: Bool = false
var body: some View {
Toggle("Toggle Button", isOn: $displayButton)
iPages {
if displayButton {
Button("Button is Displayed") { }
} else {
Button("Button is not displayed") { }
}
}
}
}
Will dig more into this issue
Any news on this matter or alternative library to use?
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) } }
}
struct ContentView_Previews: PreviewProvider { static var previews: some View { Group { ContentView() } } } `