TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Advice for a problem with the dismiss button

Forums > SwiftUI

I'm making my first app, and I have a favourite button on a page 3 pages deep. When you push the back button to go to the contentview which just uses a (@Environment(.dismiss) private var dismiss1) to go back. On the contentView I have a fav.count() showing the number of favourites selected but it doesn't update unless I close the app and restart it.

But I have just realised that instead of a dismiss, if I use a .fullscreencover (like below to go back) then it updates. But I feel somehow this will cause problems.

Question is does anyone know why it's not updating with the dismiss button or what i can do to make it update or do you know if using the .fullscreencover to go back to the home page is ok to do?

Thanks


.fullScreenCover(isPresented: $contentPage) { contentPage() }


2      

Hacking with Swift is sponsored by RevenueCat.

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.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.