At first, I was told that PrettyQrView was wrong, so I changed PrettyQrView(qrCode: qrData) to PrettyQrView.data(data: qrData), and this error disappeared, but the error in else is still the same. I don't know if it's a location issue, but even if I move the location, the error remains the same.
I wanted to fix the error in else and create a code that generates a QR code containing the ID used when the user logs in.

Based on the control flow collection proposal, you can use if-else inside a collection with a syntax like this:
Notice how there's no comma (
,) before theelsekeyword.So in order to make your code works, modify it to follow the syntax:
Alternatively, you can use the conditional operator (known as ternary operator in other languages):