Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SimformSolutionsPvtLtd/SSFacebookLogin
The Reusable Facebook Login Components for iOS is the easiest way to get data from Facebook.
https://github.com/SimformSolutionsPvtLtd/SSFacebookLogin
facebook loginmanager swift
Last synced: about 1 month ago
JSON representation
The Reusable Facebook Login Components for iOS is the easiest way to get data from Facebook.
- Host: GitHub
- URL: https://github.com/SimformSolutionsPvtLtd/SSFacebookLogin
- Owner: SimformSolutionsPvtLtd
- License: mit
- Created: 2018-03-30T07:41:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T11:58:32.000Z (2 months ago)
- Last Synced: 2024-07-23T22:03:25.596Z (about 2 months ago)
- Topics: facebook, loginmanager, swift
- Language: Swift
- Size: 153 KB
- Stars: 33
- Watchers: 9
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-SS-Mobile - SSFacebookLogin - The Reusable Facebook Login Components for iOS is the easiest way to get data from Facebook. (iOS Guides / Swift)
README
# Reusable Facebook Login Components
The Reusable Facebook Login Components for iOS is the easiest way to get user data from Facebook .
## Features
- [x] Get Default data of user from facebook
- [x] Get Specific data of user from facebook## Requirements
- iOS 8.0+
- Xcode 7.3+## Installation
### CocoaPods
To incorporate the **SSFacebookLogin** library into your Xcode project utilizing CocoaPods, please reference it within your `Podfile` as shown below:
```ruby
pod 'SSFacebookLogin'
```
### Swift Package ManagerTo add **SSFacebookLogin** as a dependency to your project, follow these steps:
1. Open your Swift project in Xcode.
2. Navigate to `File` -> `Add Package Dependencies...`.
3. Paste `https://github.com/SimformSolutionsPvtLtd/SSFacebookLogin.git` into the search bar.
4. Choose the version you want to use and click `Add Package`.### Manually
If you prefer not to use any of the dependency managers above, you can integrate **SSFacebookLogin** into your project manually.
- Just copy `LoginManager.swift`, `FaceBookConstant.swift` and `userData.swift` from the `Classes` folder into your Xcode project.
- Make sure to add Facebook SDK or Pod's for iOS.## Migration Guide
- For minimum `iOS 11.0` use `6.0.4`
- For minimum `iOS 12.0` or above use `7.0.0`## Configure App
1. Right-click `Info.plist`, and choose **Open As βΈ Source Code**.
2. Copy and paste the following XML snippet into the body of your file (`...`)
```
CFBundleURLTypes
CFBundleURLSchemes
fbAPP-ID
FacebookAppID
APP-ID
FacebookClientToken
CLIENT-TOKEN
FacebookDisplayName
APP-NAME
```
- In `CFBundleURLSchemes`, replace APP-ID with your App ID.
- In `FacebookAppID`, replace APP-ID with your App ID.
- In `FacebookClientToken`, replace CLIENT-TOKEN with the value found under Settings > Advanced > Client Token in your Facebook App Dashboard.
- In `FacebookDisplayName`, replace APP-NAME with the name of your app.
3. Add following code blocks in `AppDelegate.swift` file
- In **didFinishLaunchingWithOptions** method,
```swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Add below line for facebook configuration
LoginManager.shared.facebookConfiguration(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
```
- In **openUrlWithOption** method,
```swift
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return LoginManager.shared.faceboolUrlConfigurationWithOptions(app, open: url, options: options)
}
```
4. Voila πͺβ¨π« !
- For more details => [Facebook Integration for iOS](https://developers.facebook.com/docs/facebook-login/ios)## Usage example
##### Example 1 (Get default data of user when no any arguments passed)
```swift
LoginManager.shared.loginWithFacebook(controller: self, { (token, error) in
if error == nil {
print(token?.userID ?? "",token?.tokenString ?? "")
}
}) { (result, error) in
if error == nil {
if let userData = result as? UserData {
print(userData)
print(userData.id)
} else {
print(result ?? "")
}
}
}
```##### Example 2 (Get specific data of user by passing argument)
```swift
LoginManager.shared.loginWithFacebook(permission: [.email, .publicProfile, .userBirthday],
requriedFields: [.birthday, .about, .email], controller: self, { (token, error) in
if error == nil {
print(token?.userID ?? "",token?.tokenString ?? "")
}
}) { (result, error) inif error == nil {
if let uResult = result {
print(uResult)
}
}
}```
## π€ How to ContributeWhether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! :muscle:
Check out our [**Contributing Guide**](CONTRIBUTING.md) for ideas on contributing.
## Find this library useful? β€οΈ
Give a βοΈ if this project helped you!
## Check out our other Libraries
π Simform Solutions Librariesβ
## MIT License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details