Latest 0.0.5
Homepage https://github.com/k06a/LeaderboardKit
License MIT
Platforms ios 7.0, requires ARC
Dependencies SAMCache, VK-ios-sdk
Frameworks GameKit, Accounts, Social
Authors

iOS and OSX social leaderboards and highscore push notifications on top of Apple CloudKit

Installation

  1. pod 'LeaderboardKit'
  2. #import <LeaderboardKit/LeaderboardKit.h>
  3. Setup leaderboards inside application:didFinishLaunchingWithOptions::

    LKGameCenterIdentifierToNameTranform = ^NSString *(NSString *identifier){
       return [identifier substringFromIndex:@"scores.".length];
    };
    LKGameCenterNameToIdentifierTranform = ^NSString *(NSString *name){
       return [@"scores." stringByAppendingString:name];
    };
    [[LeaderboardKit shared] setupLeaderboardNames:@[@"3x3",@"4x4",@"5x5"]];

    for leaderboard identifiers: scores.3x3, scores.4x4 and scores.5x5

Integrate GameCenter when LeaderboardKit become ready

[[LeaderboardKit shared] whenInitialized:^{
    id<LKAccount> account = [[LeaderboardKit shared] accountWithClass:[LKGameCenter class]];
    if (!account) {
        account = [[LKGameCenter alloc] init];
        [[LeaderboardKit shared] addAccount:account];
    }

    [account requestAuthWithViewController:self success:^{
        [[[UIAlertView alloc] initWithTitle:@"Success" message:@"GameCenter account connected" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    } failure:^(NSError *error) {
        [[[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    }];
}];

Integrate social networks

  1. When need to configure some button state:

    self.connectTwitterButton.enabled = NO;
    [[LeaderboardKit shared] whenInitialized:^{
      self.connectTwitterButton.enabled = ![[LeaderboardKit shared] accountForIdentifier:LKAccountIdentifierTwitter];
    }];
  2. Connect ane social when player wants (Twitter, for example):

    if ([LeaderboardKit shared].isInitialized && ![[LeaderboardKit shared] accountForIdentifier:LKAccountIdentifierTwitter])
    {
      id<LKAccount> account = [[LKTwitterAccount alloc] initWithUserRecord:[LeaderboardKit shared].userRecord];
      [account requestAuthWithViewController:self success:^{
          [[LeaderboardKit shared] setAccount:account forIdentifier:LKAccountIdentifierTwitter];
          [[[UIAlertView alloc] initWithTitle:@"Success" message:@"Twitter account connected" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
      } failure:^(NSError *error) {
          [[[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
      }];
    }

Contribute

  1. Create fork
  2. Create new branch
  3. Add some commits to your branch
  4. Create Pull Request
  5. When pull request merged, delete brach

Latest podspec

{
    "name": "LeaderboardKit",
    "version": "0.0.5",
    "summary": "iOS and OSX social leaderboards and highscore push notifications on top of Apple CloudKit",
    "description": "Leaderboards with GameCenter, Twitter, Facebook friends and others.nFriends highscore push notifications on top of Apple CloudKit.",
    "homepage": "https://github.com/k06a/LeaderboardKit",
    "license": "MIT",
    "authors": {
        "Anton Bukov": "[email protected]"
    },
    "social_media_url": "http://twitter.com/k06a",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/k06a/LeaderboardKit.git",
        "tag": "0.0.5"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "resources": "Resources/**/*.*",
    "frameworks": [
        "GameKit",
        "Accounts",
        "Social"
    ],
    "requires_arc": true,
    "dependencies": {
        "SAMCache": [],
        "VK-ios-sdk": [
            "1.2.2"
        ]
    }
}

Pin It on Pinterest

Share This