Hi. In my app I am calling the paywall when the user reaches more than a certain number of rows. Let's say 2. Then I present the paywall. After a successful purchase I have to close and re-open the app in order to trigger the valid subscription to allow more entries. How do I fix this inline at the time of the purchase.
1.sheet(isPresented: $isShowingPaywall) {23 PaywallView()45 }Here is my save code where I trigger this.
1func save() {23 let bgcolor = selectedColor.toHex() ?? "#FFFFFF"45 print("Before SubscriptionActive: \(userViewModel.isSubscriptionActive)")67 let isSubscriptionActive = userViewModel.isSubscriptionActive89 // print("AFter SubscriptionActive: \(userViewModel.isSubscriptionActive)")1011 1213 // Retrieve the total count from UserDefaults1415 var totalCount = UserDefaults.standard.integer(forKey: "TotalCount")1617 // print("total count in beginning of save \(totalCount)")1819 // Check if it's the first entry and there's no total count saved2021 if data.isEmpty && totalCount == 0 {2223 // Allow the save2425 } else if !isSubscriptionActive && totalCount >= 3 && entryToEdit == nil {2627 // Show the paywall2829 isShowingPaywall = true3031 return3233 }3435 3637 if entryToEdit != nil {3839 entryToEdit?.title = title4041 entryToEdit?.reset = selectedResetOption.rawValue4243 entryToEdit?.defaultcount = defaultcount4445 entryToEdit?.locked = locked4647 entryToEdit?.bgcolor = bgcolor4849 } else {5051 let data = dataclass(title: title,5253 reset: selectedResetOption.rawValue,5455 defaultcount: defaultcount,5657 bgcolor: bgcolor,5859 date: Date(),6061 locked: locked6263 )6465 context.insert(data)6667 totalCount += 16869 UserDefaults.standard.set(totalCount, forKey: "TotalCount")7071 }7273 dismiss()7475 }

