GithubHelp home page GithubHelp logo

furkanvijapura / linkedinswift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tonyli508/linkedinswift

0.0 1.0 0.0 2.62 MB

Linkedin IOS SDK for Swift from IOS 7

License: MIT License

Swift 0.94% Objective-C 94.81% Ruby 0.24% C 2.71% Shell 1.29%

linkedinswift's Introduction

LinkedinSwift

CocoaPods Build Status codebeat badge Gitter

LinkedinSwift is a project for managing native LinkedIn SDK using CocoaPods

Linkedin Oauth Helper, depend on Linkedin Native App installed or not, using Linkdin IOS SDK or UIWebView to login, support Swift with iOS 7

Latest version is based on LinkedIn SDK 1.0.7 and IOSLinkedinAPI for webview auth.

How to use

pod 'LinkedinSwift', '~> 1.6.6'

Check out Example project.

  • Setup configuration and helper instance.
let linkedinHelper = LinkedinSwiftHelper(configuration: 
    LinkedinSwiftConfiguration(
        clientId: "77tn2ar7gq6lgv", 
        clientSecret: "iqkDGYpWdhf7WKzA", 
        state: "DLKDJF45DIWOERCM", 
        permissions: ["r_basicprofile", "r_emailaddress"]
    )
)

Or if you want to present in a different ViewController, using:

let linkedinHelper = LinkedinSwiftHelper(
    configuration: LinkedinSwiftConfiguration(
        clientId: "77tn2ar7gq6lgv", 
        clientSecret: "iqkDGYpWdhf7WKzA", 
        state: "DLKDJF45DIWOERCM", 
        permissions: ["r_basicprofile", "r_emailaddress"]
    ), webOAuthPresent: yourViewController
)
  • Setup Linkedin SDK settings: instruction here
  • Setup redirect handler in AppDelegate
func application(application: UIApplication, 
        openURL url: NSURL, 
        sourceApplication: String?, 
        annotation: AnyObject) -> Bool {

    // Linkedin sdk handle redirect
    if LinkedinSwiftHelper.shouldHandleUrl(url) {
        return LinkedinSwiftHelper.application(application, 
                openURL: url, 
                sourceApplication: sourceApplication, 
                annotation: annotation
        )
    }
    
    return false
}
  • Login:
linkedinHelper.authorizeSuccess({ (lsToken) -> Void in
    //Login success lsToken
}, error: { (error) -> Void in
    //Encounter error: error.localizedDescription
}, cancel: { () -> Void in
    //User Cancelled!
})
  • Fetch profile:
linkedinHelper.requestURL("https://api.linkedin.com/v1/people/~?format=json", 
    requestType: LinkedinSwiftRequestGet, 
    success: { (response) -> Void in
    
    //Request success response
    
}) { [unowned self] (error) -> Void in
        
    //Encounter error
}

Example project screenshots:

Demo photo

Known issues

It seems Linkedin 1.0.7 messed up with Bitcode support. again. You need to turn off Bitcode to make it work.

linkedinswift's People

Contributors

tonyli508 avatar readmecritic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.