|
Whenever I tap on any of the awards, the alert is shown but the app then displays the HomeView instead of showing the AwardsView. I have no idea why this is so. If I tap the button without an alert sheet, there are no issues so I assume the issue is related to the AlertSheet. Thoughts? Not too sure if this is the correct place for it and I am unable to share a video of it either. But here is the code.
|
|
I haven't started the Ultimate Portfolio myself, but you are currently showing code that works as expected. It is best to also provide the code that doesn't work as expected. The code we are going to help you debug 😉 |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
Hi guys, sorry for not getting back sooner. The code that I am sharing is the one that is not working i.e. its where the alert view is messing up the tab bar. I've actually tried that a couple of times but to no avail. Sadly, Paul does not share his source code (or at least I don't think so..) |
|
I understand this is the view where the alert is, and where it appears the problem is. However it doesn't mean that this is the code section that is giving you problems. The problem might be elsewhere. So when we look at this code, it seems to work. There is no clear reason for it not to. It could be anything. I could be the simulator. Did you try on a real device? or on a different simulator? |
|
Hmmm let me try a real device when I get back. The only thing I noticed is that removing the alert fixes the issue oddly. |
|
Hence testing on a real device or sharing the entire code. The above code works when we tried it. So if it persists on a real device, then the only remaining explanation is to be found in the rest of the code. When debugging I have found it best to start with an assumption, if it works out, great. If it doesn't or if I still don't understand why, check the rest of the code. It's a painstaking process but... well... welcome to coding 😉 |
|
Hi @MarcusKay. Thanks for sharing. I did try on a my device and it is till replicating the issue. I've tried browsing around my code and could not find a reason for it aside from removing the alert. Here is the repo https://github.com/StormKop/UltimatePortfolio. Appreciate any feedback you have :) |
|
The bug was not strictly HomeView, but as soon as you tap on an award, it goes back to whichever tab was selected. This helped in focusing in the issue. It had to do with the TabView, not just Home. That got me focused on the tags and when I compared to my code again, I noticed a tiny difference that fixed the issue.
We missed it... tag should be an Optional String... |
|
Oh my so blinded. Thanks @MarcusKay! I wonder why not having the optionality caused such an odd behaviour. It seems rather hard to catch. |
|
It has to do with TabView. If you dig into the documentation you will find this:
Which is why we declared our |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.