Request review in SwiftUI

The requestReview() method of SKStoreReviewController is deprecated in iOS 14 beta. There is a new requestReview(in windowScene: UIWindowScene), but with the App structure in SwiftUI, there is no UIWindowScene. How to request app review?
Answered by iTarek in 638888022
Code Block
import StoreKit
if let windowScene = UIApplication.shared.windows.first?.windowScene { SKStoreReviewController.requestReview(in: windowScene) }

Have you figured this out yet? Looking for an answer myself.
Accepted Answer
Code Block
import StoreKit
if let windowScene = UIApplication.shared.windows.first?.windowScene { SKStoreReviewController.requestReview(in: windowScene) }

This might be useful for iOS 15+:

// try getting current scene
guard let currentScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
      print("UNABLE TO GET CURRENT SCENE")
      return
}
     
// show review dialog
SKStoreReviewController.requestReview(in: currentScene)

This might be useful for iOS 15+:

// try getting current scene
guard let currentScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
      print("UNABLE TO GET CURRENT SCENE")
      return
}
     
// show review dialog
SKStoreReviewController.requestReview(in: currentScene)
Request review in SwiftUI
 
 
Q