
The optional Bool paid is nil. It gets assigned a value. The value is printed. Next line of code i have an else if. The value is nil. Question: how and why?

The optional Bool paid is nil. It gets assigned a value. The value is printed. Next line of code i have an else if. The value is nil. Question: how and why?
It seems the value is being accessed before it's ready. You'll need to unwrap it to be sure it's assigned before use.
try this:
guard let safePaid = paid else { return }
You're printing dict["paid"] instead of paid. If you print paid, you'll probably see that it's nil.