Rate Application functionality in Swift

func rateApp(appId: String, completion: @escaping ((_ success: Bool)->())) {
    guard let url = URL(string : "itms-apps://itunes.apple.com/app/" + appId) else {
        completion(false)
        return
    }
    guard #available(iOS 10, *) else {
        completion(UIApplication.shared.openURL(url))
        return
    }
    UIApplication.shared.open(url, options: [:], completionHandler: completion)
}

Method, change appId by your App ID

rateApp(appId: "id959379869") { success in
    print("RateApp \(success)")
}

id959379869 This is the id when you go on your Itune page of your app

Example : https://itunes.apple.com/fr/app/hipster-moustache/id959379869?mt=8

How get the ID :

  • Itunesconnect account
  • My Apps
  • Click on "+" Button
  • New iOS App
  • Fill require details
  • After filling all details goto your App
  • Click on More Button
  • View on AppStore
  • It will redirect you to your App URL this will be universal
  • Look Http URL