Swiftpack.co -  crashoverride777/swifty-rate as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
crashoverride777/swifty-rate
A Swift library to show a SKStoreReviewController or a custom app rating alert.
.package(url: "https://github.com/crashoverride777/swifty-rate.git", from: "v3.2.4")

Swift 5.0 Platform SPM supported CocoaPods Compatible

SwiftyRate

A Swift library to show a SKStoreReviewController (iOS 10.3 or above) or custom UIAlertController with similar rules and behaviours.

Requirements

  • iOS 9.3+
  • Swift 5.0+

Installation

Cocoa Pods

CocoaPods is a dependency manager for Cocoa projects. Simply install the pod by adding the following line to your pod file

pod 'SwiftyRate'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

To add a swift package to your project simple open your project in xCode and click File > Swift Packages > Add Package Dependency. Than enter https://github.com/crashoverride777/swifty-rate.git as the repository URL and finish the setup wizard.

Alternatively if you have a Framwork that requires adding SwiftyRate as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/crashoverride777/swifty-rate.git", from: "3.5.0")
]

Manually

Alternatively you can copy the Sources folder and its containing files into your project.

Usage

  • Add the import statement when using CocoaPods or SwiftPackageManager
import SwiftyRate 
  • Request review

As Apple describes in the documentation for SKStoreReviewController

"Although you should call this method when it makes sense in the user experience flow of your app, the actual display of a rating/review request view is governed by App Store policy. Because this method may or may not present an alert, it's not appropriate to call it in response to a button tap or other user action."

UIViewController

let ratingsRequest = SwiftyRate.Request(
    afterAppLaunches: 15,
    customAlertTitle: "Enjoying this app"?,
    customAlertMessage: "Tap the stars to rate it on the App Store.",
    customAlertActionCancel: "Not Now"
)
SwiftyRate.requestReview(ratingsRequest, from: self)

SKScene (needs to be called outside/after DidMoveToView or it will not work)

if let viewController = view?.window?.rootViewController {
    let ratingsRequest = SwiftyRate.Request(...)
    SwiftyRate.requestReview(ratingsRequest, from: viewController)
}

License

SwiftyRate is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 23
Last commit: 15 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

License
20 weeks ago
  • Update license dates

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API