Latest 0.2.3
Homepage https://github.com/goodmase/SGReviewTableView
License MIT
Platforms ios 9.0
Dependencies RateView
Authors

CI Status
Version
License
Platform

SGReviewTableView Example

Example Project

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

Installation

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

pod "SGReviewTableView"

Documentation

http://cocoadocs.org/docsets/SGReviewTableView/

Usage

Basic Example

Objective-C

@import SGReviewTableView;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //create a review
    SGReview *review = [[SGReview alloc] initWithRating:5.0 content:@"Excellent!" andDate:[NSDate new]];

    SGReviewTableViewController *reviewTableView = [[SGReviewTableViewController alloc] initWithReviews:@[review]];
    reviewTableView.graphBarColor = [UIColor redColor];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:reviewTableView];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];

    return YES;
}

@end

Swift

import UIKit
import SGReviewTableView

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let r = SGReview(rating:4.5, content:"Awesome!", andDate:Date())
        let reviewTableView = SGReviewTableViewController(reviews: [r!])
        reviewTableView?.graphBarColor = UIColor.red;
        let nav = UINavigationController(rootViewController: reviewTableView!)
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.rootViewController = nav
        self.window?.makeKeyAndVisible()

        return true
    }
}

SGReview

The SGReviewTableViewController accepts an array of SGReview objects. Currently only ratings of 0.0-5.0 are valid ratings.

Objective-C

SGReview *review = [[SGReview alloc] initWithRating:5.0 content:@"Excellent!" andDate:[NSDate new]];

Swift

let review = SGReview(rating:4.5, content:"Awesome!", andDate:Date())

Customization

Currently customization is limited. The following properties can be customized on SGReviewTableViewController:

  • graphBarColor – customize the color of the histogram bars at the top of the table view.

Author

Stephen Goodman, [email protected]

License

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

Latest podspec

{
    "name": "SGReviewTableView",
    "version": "0.2.3",
    "summary": "A basic table view controller for showing reviews.",
    "description": "SGReviewTableView is a pod that provides a table view for displaying user reviews. The view includes a header that shows a histogram of the ratings, average rating, and the number of reviews.",
    "homepage": "https://github.com/goodmase/SGReviewTableView",
    "screenshots": "https://github.com/goodmase/SGReviewTableView/blob/master/screenshot.png?raw=True",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "goodmase": "[email protected]"
    },
    "source": {
        "git": "https://github.com/goodmase/SGReviewTableView.git",
        "tag": "0.2.3"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "SGReviewTableView/Classes/**/*",
    "dependencies": {
        "RateView": [
            "~> 1.2"
        ]
    }
}

Pin It on Pinterest

Share This