Contents

higracehuang/solicitreviewlibrary

SolicitReviewLibrary is a Swift package that manages the simple flow of the review solicitation process.

Review Prompt

  1. Add SolicitReviewLibrary (https://github.com/higracehuang/SolicitReviewLibrary.git) to the Package Dependencies of your iOS or macOS app project.
  1. Import SolicitReviewLibrary, and call SolicitReviewLibrary.appInit() in the App module.

For example, in the ExampleApp:

import SwiftUI
import SolicitReviewLibrary

@main
struct ExampleApp: App {
  init() {
    SolicitReviewLibrary.appInit() // 0) Init for the app
  }
  var body: some Scene {
    WindowGroup {
      ContentView()
    }
  }
}
  1. Call requestReview on the UI where you would like to solicit reviews.

For example, after the user clicks the button 10 times, it will prompt to solicit a review.

import SwiftUI
import SolicitReviewLibrary

struct ContentView: View {
  @State private var buttonTapped = false
  
  let solicitReviewLibrary = SolicitReviewLibrary(checkpointCount: 10) // 1) Init
  
  var body: some View {
    VStack {
      Text("Button is \(buttonTapped ? "Tapped" : "Not Tapped")")
        .padding()
      
      Button(action: {
        self.buttonTapped.toggle()
        solicitReviewLibrary.requestReview() // 2) Prompt for review
        // let isPrompted = solicitReviewLibrary.requestReviewIfNecessary() // or use this to check if the review was prompted
      }) {
        Text("Tap Me!")
          .padding()
          .background(Color.blue)
          .foregroundColor(.white)
          .cornerRadius(8)
      }
    }
  }
}

Review Daily

requestReviewDaily() ensures that engagement is recorded only once per calendar day. This maps checkpointCount to "usage days" rather than "action counts".

solicitReviewLibrary.requestReviewDaily()
  1. Build the app and test.

Package Metadata

Repository: higracehuang/solicitreviewlibrary

Default branch: main

README: README.md