It's recommended to add a transaction observer to the payment queue on app launch, in the app delegate method. With the new App structure in iOS 14, where should the transaction observer be added?
It's important to add the transaction observer as early as possible in your app's life cycle, and make sure it is added on every launch. In a UIKit app, you can check both boxes by adding it in application(_:didFinishLaunchingWithOptions:). You have several options using the new SwiftUI app life cycle in iOS 14. Here are a couple ideas:
You can use @UIApplicationDelegateAdaptor and add your observer in application(_:didFinishLaunchingWithOptions:)
You can use some @StateObject in your App, and add the transaction observer in the initializer for this object. This is the route I would use, as I usually already have some @StateObject to manage my in app purchase logic.