- Nov 2, 2025
How to Request App Store Reviews Using StoreKit in SwiftUI
- DevTechie
- SwiftUI
Getting users to rate your app is important, but the rating option is often hidden away in the settings screen. This screen should look just as polished as the rest of your app, while also being fully functional and able to post reviews directly to your App Store page.
Luckily, StoreKit makes this process simple with the requestReview Environment function, which allows you to prompt users for a review seamlessly.
In this tutorial, we’ll explore how to use it with an example. We’ll create a simple card-style UI displayed in a list. Let’s start by defining a basic data structure for our card.
struct CardItem: Identifiable {
let id = UUID()
let title: String
let imageName: String
}Next, create a SwiftUI view called CardView to layout Image and Text in card style UI.
struct CardView: View {
let title: String
let systemImageName: String
var body: some View {
HStack {
Image(systemName: systemImageName)
.resizable()
.scaledToFit()
.frame(width: 30, height: 30)
.foregroundStyle(.blue)
Text(title)
.font(.headline)
.foregroundStyle(.primary)
Spacer()
}
.padding()
.background(Color.primary.colorInvert())
.clipShape(.rect(cornerRadius: 20))
.shadow(color: Color.primary.opacity(0.15), radius: 5, x: 0, y: 3)
.padding(.horizontal)
}
}Now we’re ready to put everything together inside a view. Here, we’ll also use the Environment function to access requestReview. This function will be triggered when the user taps the button in the toolbar.
The @Environment(\.requestReview) property wrapper gives us access to the system-provided function that allows our app to request a review from the user. By declaring it as an environment value, we can easily call requestReview() anywhere within the view hierarchy without manually handling StoreKit logic. This makes it simple and clean to prompt users for feedback or ratings at appropriate moments in the app experience.
Start with import of StoreKit framework
import StoreKitThe rest of the view is a standard SwiftUI layout that displays the CardView and includes a button to trigger the requestReview() call.
struct StoreKitReviewExample: View {
@Environment(\.requestReview) var requestReview
let cardData: [CardItem] = [
CardItem(title: "Settings", imageName: "gear"),
CardItem(title: "Profile", imageName: "person.circle"),
CardItem(title: "Favorites", imageName: "heart.fill"),
CardItem(title: "Messages", imageName: "envelope.fill")
]
var body: some View {
NavigationStack {
ZStack {
LinearGradient(colors: [.pink.opacity(0.3), .blue.opacity(0.3)], startPoint: .topLeading, endPoint: .bottomTrailing)
.ignoresSafeArea()
List {
ForEach(cardData) { item in
CardView(title: item.title, systemImageName: item.imageName)
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
}
}
.listStyle(.plain)
.scrollContentBackground(.hidden)
.navigationTitle("DT App Review Example")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button("Rate Us") {
requestReview()
}
}
}
}
}
}
}