How to ask the user to review your app

Sep 22, 2022 1 min read
How to ask the user to review your app

iOS 16+

If you import StoreKit into your SwiftUI app, you’ll gain access to an environment key called requestReview, which allows you to prompt the user to leave a review for your app.

To use it, first important StoreKit into your project, add the environment key as property in your view, then call it at an appropriate time. Here’s some code to get you started:

import StoreKit
import SwiftUI

struct ContentView: View {
    @Environment(\.requestReview) var requestReview

    var body: some View {
        Button("Review the app") {
Great! Next, complete checkout for full access to ArturoFM.
Welcome back! You've successfully signed in.
You've successfully subscribed to ArturoFM.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.