Hey All,
I am stumped trying figuring this one out. I have the following for loop in the viewDidLoad:
for pass in lection {
if pass.specialDay == theDate && pass.day == "AfterChristmas" && theMonth == "12" {
year.text = pass.year
titleName.text = pass.title
specialAdd = true
}
else if pass.week == theWeek && pass.day == prayerDay {
year.text = pass.year
titleName.text = pass.title
specialAdd = false
} // end if
} //end single pass of loop
It works exactly as expected in viewDidLoad it chooses the first if statement, but when this same loop is placed in a segment switch in the same viewController, it always defaults to the second if statement.
When I query the pass.specialDay it returns the record in the array pointing to the second if statement not the correct record.
Please correct my logic if I am missing something, but when the for loop runs, it will loops through the entire arrary looking for the first if statement, and if it does not find it, it will then run again looking for the second if? Or will both statements be evaluated by each pass of the loop?
If is is the latter, I wonder why it correctly grabs the right data in the viewDidLoad?
Clearly, I need to walk away and look at this again later! Lol
Thanks!
Blessings,
—Mark