I have a button which is connected to a presented .Sheet when pressed which has simple if/else statement inside. However, when this particular Bool ssdiElig
is true it still registers as false on the view.
Here is my button code and below that the function that gives me the ssdiElig value (bool) for the .sheet if/else statement.
ZStack {
VStack {
Button(action: {mspEligibility(); ssdiEligibility(); ssiEligibility(); mspEligibility2(); PAzipcode(); mspEligibility3();
self.isOpen = true
print(ssdiElig)
}, label: {
Text("View Results")
}).sheet(isPresented: $isOpen, content: {
if ssdiElig {
Text("ssdi yes")
} else {
Text("ssdi no")
}
}
)}
This function will give ssdiElig
Bool the value
func ssdiEligibility() {
if disabled == true && income <= 803 {
print("SSDI Eligible")
ssdiElig = true
} else if ssdiBen == true || ssiBen == true {
print("Not SSDI Eligible")
ssdiElig = false
} else {
print("Not SSDI Eligible")
ssdiElig = false
}
}
Inside the console, ssdiElig
prints out true. Also, SSDI Eligible is printed out as well.
So, to me, its just the if statement that isn't working for some reason?