HomeiOS Developmentios - The place to launch sheet confirming subscription buy in SwiftUI

ios – The place to launch sheet confirming subscription buy in SwiftUI


When a consumer purchases a subscription on the App Retailer and the system sends again a dialog affirmation, “You are all set”. I’ve been utilizing this to launch my very own alert that claims Congratulations. Nonetheless, following the instance on this WWDC video, I wish to show a sheet that comprises extra data.

Nonetheless, I can not seem to get the sheet to show when I attempt to present it from the identical location because the alert in a parallel method.

Can anybody clarify to me why this won’t be working and learn how to get it to work?

Listed below are the details within the code:

struct paywallView: View {
  
    @State var showingSubConfirm = false
   
     var physique: some View {
        
       
     VStack {

     Button("Buy"){
                    
                    if let trialSubscription {
                        
                        Process{
                            attempt await _ = Retailer.shared.buy(trialSubscription)
                           
                            
                            if Retailer.shared.isSubscribed {
                                showingSubConfirm = true
                                
                            }
                        }
                        
                    } 
                }//finish button

//THIS ALERT WORKS FIND

.alert("Congratulations!", isPresented: $showingSubConfirm) {
                Button("OK",position:.cancel) {
                    
                }
 }//finish alert

  //THIS SHEET DOES NOT DISPLAY

 .sheet(isPresented: $showingSubConfirm) {
                 
  if let url = Bundle.most important.url(forResource: "congrats", withExtension: "html") {
                    WebView(url: url)
                    
             }
         }

}//finish vstack
}/finish some view

The alert shows correctly, however the sheet doesn’t show. I do know the sheet is legitimate as a result of if I alter the worth of showingSubConfirm someplace else–eg not within the activity, it’s going to show correctly.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments