SwiftUI request review: Complete guide

This article provides insights into the SwiftUI implementation of review requests, offering practical guidance on code usage and adherence to Apple’s best practices for soliciting feedback effectively.

In this blog post we will cover how to request a review in SwitUI, we will also cover best practices on when to ask for a review and Apple’s guidelines.

How do you request a review in SwiftUI?

The code itself for displaying the review prompt from Apple is straightforward. All you need to do is import StoreKit, create an environment variable, and use the variable.

In the following example, we will create a button and when you press the button it opens the review prompt.

import SwiftUI
import StoreKit

struct StoreReviewView: View {
    @Environment(\.requestReview) var requestReview
    var body: some View {
        Button {
            requestReview()
        }label: {
            Text("Request apple view")
        }
    }
}

#Preview {
    StoreReviewView()
}

The result:

Best practices when to ask for review

Apple has put up a few guidelines on when and how to ask for a review. If you follow their guidelines you will be good — keep in mind the users can disable the ability to request reviews.

1. Request at a time that doesn’t interrupt what someone is trying to achieve in your app, for example, at the end of a sequence of events that they successfully complete.

2. Avoid showing a request for a review immediately when a user launches your app, even if it isn’t the first time it launches.

3. Avoid requesting a review as the result of a user action.

NB: One really important note is that Apple have a limit that you can prompt the same user a maximum of three times every 365 days.

When should I request a review?

That is a good question, the point in making a review request is to get a good review so your application can rise to the top of the app store.

So following the guidelines presented by Apple, I always make sure the user is using the app and has been using it for some time.

Here you have a few points on when to request a review that I use:

1. Set the minimum number of times the app is opened to 15.

2. Your app has some kind of interaction, make sure they used that a few times — 5 to 10 times should do.

Wrap up request review in SwiftUI

In conclusion, requesting a review in Swift is a straightforward process facilitated by the StoreKit framework. By importing StoreKit, creating an environment variable, and implementing it within the code, developers can easily prompt users to leave reviews.

Following Apple’s guidelines is crucial for effectively prompting reviews without disrupting the user experience. These guidelines recommend timing review requests to occur after users have completed tasks within the app and have been using it for some time, avoiding interruptions or immediate prompts upon app launch.

It’s important to note that Apple imposes a limit of three review prompts per user per year.

By following best practices and considering user engagement metrics such as app usage frequency and interaction, developers can optimize their review request strategy to maximize the likelihood of positive reviews and enhance their app’s visibility on the App Store.

I hope you can use this in your application — happy coding 🙂

Scroll to Top