Swiftpack.co - Package - crashoverride777/swifty-rate

SwiftyRate

Swift 5.0 Platform CocoaPods Compatible

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

iOS 11

Apple has updated the app store guidlines and it seems that with iOS 11 you are no longer allowed to show custom review prompts, at least automatic ones. I assume this also will apply to tvOS which sucks a bit because SKStoreReviewController is not supported on tvOS.

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 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

Altenatively you can drag the SwiftyRate.swift file manually 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)
}

Github

link
Stars: 19

Dependencies

Used By

Total: 0

Releases

Cleanup - 2020-02-23 14:19:59

Project cleanup

Update licence - 2020-02-22 14:33:24

Update licence

Request model and lower target - 2020-02-22 14:24:54

Add request model to add your own localised strings for the custom alert title, message and cancel action. Lowered target to iOS 9.3

Swift Package Manager - 2020-02-08 14:03:15

Add support for Swift Package manager

Bugfixes - 2019-09-13 22:01:16

Swift 5 - 2019-03-27 19:07:50

  • Updated to Swift 5
  • Set min deployment target to 10.3

SwiftyRate - 2018-09-16 14:14:32

Updated to Swift 4.2

SwiftyRate - 2018-03-04 11:56:17

Cleanup

SwiftyRate - 2018-03-03 16:04:56

Cleanup

SwiftyRate - 2017-09-24 14:32:56

Swift 4 update

SwiftyRate - 2017-05-05 12:38:27

Updated request method (please see instructions)

Print statements will now only print in DEBUG mode

Cleanup

SwiftyRate - 2017-04-17 14:18:34

Cleanup

SwiftyRate - 2017-04-08 15:27:50

Fixed request method when using custom app launches

SwiftyRate - 2017-04-03 15:13:53

The app ID is now fetched automatically

Updated alert text

SwiftyRate - 2017-03-27 20:34:14

Updated to Swift 3.1

Added SKStoreReviewController

Renamed "Cancel" button to "Not Now"

SwiftyRate - 2017-02-28 14:47:02

Cleanup

SwiftyRateAppAlert - 2017-02-24 16:27:03

Redesigned to behave more like the upcoming SKStoreReviewController

SwiftyRateAppAlert - 2016-10-03 17:50:05

Project has been renamed to SwiftyRateAppAlert.

No more source breaking changes after this update. All future changes will be handled with deprecated messages.

Swift-RateAppAlert - 2016-10-02 13:10:24

Changed helper into a enum with static method to make API clearer.

Swift-RateAppAlert - 2016-09-08 03:29:42

Updated to Swift 3

Swift-LeaveAppReview-Helper - 2016-07-09 22:41:44

  • Small tweaks

Swift-LeaveAppReview-Helper - 2016-07-06 11:53:04

  • Small tweaks and improvements

LeaveAppReview-Helper - 2016-05-19 19:36:33