func rateApp() {
var ud = UserDefaults.standard.integer(forKey: "rew")
NSLog("rew show count is %d", ud)
if(ud >= 1)
if #available(iOS 14.0, *) {
if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
SKStoreReviewController.requestReview(in: scene)
NSLog("rateappios14")
} else {
// Fallback on earlier versions
SKStoreReviewController.requestReview()
NSLog("rateappotherios")
ud = ud + 1
UserDefaults.standard.setValue(ud, forKey: "rew")
UserDefaults.standard.synchronize()
}