BFRating 1.0.4

BFRating 1.0.4

Maintained by Matthias Nagel.



 
Depends on:
SwiftyUserDefaults>= 0
Localize-Swift>= 0
 

BFRating 1.0.4

BFRating

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

Before you start we can recommend to read the bloc article. Here we describe the basic workflow of BFRating.

Use it!

First you have to initialize the RatingProvider. Then you can call the showRatingDialog() function from any UIViewController.

let ratingProvider = RatingProvider(controller: self, tintColor: .green) //Default value UIColor.blue

// Customize alert directly in function
ratingProvider.showRatingDialog(afterDays: 10, afterViewCount: 3, onYesFeedback: nil, onLaterFeedback: nil) {
    //Eg. show MFMailComposeViewController to get user feedback
}

There is also a reset() function to go back to a clean state.

You can also call rating dialog with showRatingDialogOnClick() to show it when user clicks on button.

// Call rating dialog
ratingProvider.showRatingDialogOnClick(onYesFeedback: {
    // Do something here
}, onLaterFeedback: {
    // Ask user to rate app again later
}, onNoFeedback: {
    // Open support chat or
    // show MFMailComposeViewController to get user feedback
})

You can set up an array of custom variables, to let rating provider appear after variables gets valid values.

// Call rating dialog after custom values
let gamePlayed = 3
let boughtItems = 1

ratingProvider.showRatingDialog(customValues: [gamePlayed, boughtItems], onLaterFeedback: {
// Reset user values
    ratingProvider.resetUserValues()
}, onNoFeedback: {
    // Show support chat and reset user values
    ratingProvider.resetUserValues()
})

// F.e. user has played 3 games and bought 1 item
// Set values with function:

ratingProvider.setUserValues([3, 1])
// Then ratingProvider.showRatingDialogAfterCustomValue will be called
}

resetUserValues() function will reset uservalues to [].

Installation

BFRating is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BFRating'

Author

Matthias Nagel, [email protected]

License

BFRating is available under the MIT license. See the LICENSE file for more info.