Latest 0.0.3
Homepage https://github.com/darkcl/SocialLib
License MIT
Platforms ios 7.0, requires ARC
Frameworks Accounts, ImageIO, SystemConfiguration, CoreText, QuartzCore, Security, UIKit, Foundation, CoreGraphics, CoreTelephony, SystemConfiguration, MobileCoreServices
Authors

CI Status
Version
License
Platform

What is SocialLib?

SocialLib is a library that aims to share information to different social media site without getting your code messy with different social media SDKs.

Sharing with SocialLib is simple, you can have the same modal to share to different social media.

Here is an example for the same modal to share to Twitter and Facebook.

InfoModal.h

#import <Foundation/Foundation.h>

@interface InfoModal : NSObject <SocialLibFacebookMessage, SocialLibTwitterMessage>{

}

@property (nonatomic, strong) NSString *infoTitle;
@property (nonatomic, strong) NSString *infoContent;
@property (nonatomic, strong) NSString *infoContentURL;
@property (nonatomic, strong) NSArray *infoImages;
@property (nonatomic, strong) NSString *infoThumbnailImageURL;
@property (nonatomic, strong) NSString *infoVideoURL;

InfoModal.m

#import "InfoModal.h"

@implementation InfoModal

#pragma mark - SocialLibMessage
- (NSString *)title{
    return _infoTitle;
}

- (NSString *)content{
    return _infoContent;
}

- (NSString *)contentURL{
    return _infoContentURL;
}

- (NSArray *)images{
    return _infoImages;
}

- (NSString *)thumbnailImageURL{
    return _infoThumbnailImageURL;
}

- (NSString *)videoURL{
    return _infoVideoURL;
}

- (NSString *)tweetContent{
    return [NSString stringWithFormat:@"%@ - %@ %@",_infoTitle, _infoContent, _infoContentURL];
}

- (SocialLibTwitterMessageType)twitterMessageType{
    return SocialLibTwitterMessageTypeText;
}

- (SocialLibFacebookMessageType)fbMessageType{
    return SocialLibFacebookMessageTypeLink;
}

@end

To share facebook use

InfoModal *info = [[InfoModal alloc] init];
info.infoTitle = @"SocialLib";
info.infoContent = @"Share via SocialLib";
info.infoContentURL = @"http://darkcl.github.io/SocialLib";
[SocialLib shareModal:info
           toPlatform:kSocialLibPlatformFacebook
              success:^(NSDictionary *message) {
                  NSLog(@"%@", message);
              }
              failure:^(NSDictionary *message, NSError *error) {
                  NSLog(@"%@", error);
              }];

To share twitter use

InfoModal *info = [[InfoModal alloc] init];
info.infoTitle = @"SocialLib";
info.infoContent = @"Share via SocialLib";
info.infoContentURL = @"http://darkcl.github.io/SocialLib";
[SocialLib shareModal:info
           toPlatform:kSocialLibPlatformTwitter
              success:^(NSDictionary *message) {
                  NSLog(@"%@", message);
              }
              failure:^(NSDictionary *message, NSError *error) {
                  NSLog(@"%@", error);
              }];

Installation

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

Install all platform (Facebook, Twitter, Tumblr, Instagram, Weibo and Weixin)

pod 'SocialLib'

For specific social platform, use subspec

pod 'SocialLib/Facebook'
pod 'SocialLib/Twitter'
pod 'SocialLib/Tumblr'
pod 'SocialLib/Instagram'
pod 'SocialLib/Weibo'
pod 'SocialLib/Weixin'

Setup Guide

You can find setup guide in the wiki

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.
Demo provided Facebook, Twitter and Tumblr api keys, Weibo and Weixin api keys are empty

Author

Yeung Yiu Hung, [email protected]

License

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

Bitdeli Badge

Latest podspec

{
    "name": "SocialLib",
    "version": "0.0.3",
    "summary": "SocialLib handles sharing message to multiple social media.",
    "description": "SocialLib handles sharing message to multiple social media.nNow support twitter, facebook, tumblr, wechat (weixin) and weibo.",
    "homepage": "https://github.com/darkcl/SocialLib",
    "license": "MIT",
    "authors": {
        "Yeung Yiu Hung": "[email protected]"
    },
    "source": {
        "git": "https://github.com/darkcl/SocialLib.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "frameworks": [
        "Accounts",
        "ImageIO",
        "SystemConfiguration",
        "CoreText",
        "QuartzCore",
        "Security",
        "UIKit",
        "Foundation",
        "CoreGraphics",
        "CoreTelephony",
        "SystemConfiguration",
        "MobileCoreServices"
    ],
    "libraries": [
        "c++",
        "z",
        "sqlite3",
        "icucore"
    ],
    "default_subspecs": [
        "Core",
        "Facebook",
        "Twitter",
        "Tumblr",
        "Weibo",
        "Weixin",
        "Instagram"
    ],
    "subspecs": [
        {
            "name": "Core",
            "source_files": "Pod/Classes/Core/*.{h,m}"
        },
        {
            "name": "Facebook",
            "source_files": "Pod/Classes/Facebook/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": [],
                "FBSDKCoreKit": [],
                "FBSDKLoginKit": [],
                "FBSDKShareKit": []
            }
        },
        {
            "name": "Twitter",
            "source_files": "Pod/Classes/Twitter/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": [],
                "STTwitter": []
            }
        },
        {
            "name": "Tumblr",
            "source_files": "Pod/Classes/Tumblr/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": [],
                "AFOAuth1Client": []
            }
        },
        {
            "name": "Weibo",
            "source_files": "Pod/Classes/Weibo/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": [],
                "WeiboSDK": []
            }
        },
        {
            "name": "Weixin",
            "source_files": "Pod/Classes/Weixin/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": [],
                "Weixin": []
            }
        },
        {
            "name": "Instagram",
            "source_files": "Pod/Classes/Instagram/*.{h,m}",
            "dependencies": {
                "SocialLib/Core": []
            }
        }
    ]
}

Pin It on Pinterest

Share This