Hi,
I have the following code, which for some reason is not working as expected. I have an .onAppear and a .task function that isn't running, which I can see isn't running because nothing is printing. Any guidance would be greatly appreciated. Thank you.
struct ContentView: View {
var body: some View {
ZStack {
switch view {
case .view1: View1()
case .view2: View2()
case .view3: View3()
case .view4: View4()
case .view5: View5()
default: SubscriptionStoreView(groupID: "")
}
}
.onAppear() {
view = .view6
print("test 1")
}
.task {
print("test")
await refreshPurchasedProducts()
}
}
func refreshPurchasedProducts() async {
// Iterate through the user's purchased products.
for await verificationResult in Transaction.currentEntitlements {
switch verificationResult {
case .verified(let transaction): print("verified")
case .unverified(let unverifiedTransaction, let verificationError): print("unverified")
default: print("default")
}
}
}
}