However, the part with the if runs before it can be purchased
Please clarify: Where is the part with the if?
When is the time it can be purchased?
In my opinion, your code is too complex than it should be so just showing the code does not explain enough.
Topic:
Programming Languages
SubTopic:
Swift
Tags: