Latest 0.4.0
Homepage https://github.com/sauravexodus/RxFacebook
License MIT
Platforms ios 8.0
Dependencies RxSwift, FacebookLogin, FacebookCore
Authors

RxFacebook

[![Version](https://img.shields.io/cocoapods/v/RxFacebook.svg?style=flat)](http://cocoapods.org/pods/RxFacebook)
[![License](https://img.shields.io/cocoapods/l/RxFacebook.svg?style=flat)](http://cocoapods.org/pods/RxFacebook)
[![Platform](https://img.shields.io/cocoapods/p/RxFacebook.svg?style=flat)](http://cocoapods.org/pods/RxFacebook)

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

“`swift
import FacebookLogin
import FacebookCore

class Example {
let loginManager = LoginManager()

func signIn() {
loginManager.rx.logIn(with: [.publicProfile]).flatMap { [weak self] (loginResult) -> Observable in
guard let strongSelf = self else { return .just((nil, “Something went wrong”)) }
switch loginResult {
case .cancelled: return .just((nil, “User cancelled the result”))
case let .failed(error): return .just((nil, error.localizedDescription))
// Extract the facebook login result here and chain it with your graph request
case let .success(acceptedPermissions, declinedPermissions, accessToken): return strongSelf.fetchEmail()
}
}
.subscribe(onNext: { email, error in
if let `email` = email {
print(email)
} else if let `error` = error {
print(error)
}
})
.disposed(by: disposeBag)
}

func fetchEmail() -> Observable {
let graphRequest = GraphRequest(graphPath: “/me”)
return graphRequest.rx.getResponse().map { result in
switch result {
case let .success(response):
guard let objectMap = response.dictionaryValue, let email = objectMap[“email”] as? String else { return (nil, “Couldn’t find email”) }
return (email, nil)
case let .failed(error):
return (nil, error.localizedDescription)
}
}
}
}
“`

## Requirements
“`ruby
pod ‘RxSwift’
pod ‘FacebookCore’
pod ‘FacebookLogin’
“`

## Installation
RxFacebook is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

“`ruby
pod ‘RxFacebook’
“`

## Author
Sourav Chandra
RxSwift Enthusiast
[email protected]

## License
RxFacebook is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RxFacebook",
    "version": "0.4.0",
    "summary": "Reactive extensions for Facebook Login and Graph Request Libraries.",
    "description": "Reactive extensions for Facebook Login and Graph Request Libraries.nIt helps alot when you are chaining multiple graph requests after a login request.",
    "homepage": "https://github.com/sauravexodus/RxFacebook",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "sauravexodus": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sauravexodus/RxFacebook.git",
        "tag": "0.4.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "RxFacebook/Classes/**/*",
    "dependencies": {
        "RxSwift": [
            ">=3.0"
        ],
        "FacebookLogin": [
            ">=0.2.0"
        ],
        "FacebookCore": [
            ">=0.2.0"
        ]
    }
}

Pin It on Pinterest

Share This