Get Reactions from Timeline Post via Facebook Graph API – Swift – iOS

Facebook Reactions
Facebook Reactions

New version of SDK is 4.16.x(Swift) and Graph API Version is 2.8.

With the Graph API 2.6 Facebook has given support to fetch (read only) the Reactions on Timeline Posts.

Post is updated for iOS 10 and Swift 3

API documentation is available here.

Let’s learn how to get reactions from the post

Install pods

Login with Facebook

I have already written a tutorial on Facebook Login.

Get Facebook Posts via Graph API

We can get the Facebook post via graph API : /me/posts for that we have to add user_posts permission with login.

Get Reactions from one of the Post

We can get the Facebook post reactions via graph API : /{post-id}/reactions. We have to pass parameters like fields and summary as described in getReactions function.

Note : Here I am writing sample for only first post.

Response should be like

Type of reactions : NONE, LIKE, LOVE, WOW, HAHA, SAD, ANGRY

#Like #Share #React 🙂 😛 😀

Happy coding 🙂

How to create a wrapper for Alamofire and SwiftyJSON? Swift – iOS

This blogpost updated with Swift 3 – Xcode 8 – iOS 10 – Alamofire 4.0


I have posted a basic tutorial about Alamofire and SwiftyJSON How to use Alamofire and SwiftyJSON with Swift?

And some day before we have learned about Use of Blocks(Closures) or Completion Handlers with Function in Swift – iOS

Let’s combine both the topics to make a WRAPPER of Alamofire and SwiftyJSON.
Continue reading

How to use Alamofire and SwiftyJSON with Swift? – Swift 3 – iOS 10 – Xcode 8

Swift JSON
Swift JSON

Alamofire is an HTTP networking library written in Swift.
SwiftyJSON makes it easy to deal with JSON data in Swift.
Continue reading

How to work with IBDesignable and IBInspectable in Swift Language?

IBDesignable with Storyboard
IBDesignable with Storyboard

How to use the @IBDesignable and @IBInspectable?

By giving you a simple example that we can not change the corner radius from the design view. We have to change it run time. If you want to make possible it with design time then you can use the @IBDesignable and @IBInspectable.

So, We are taking an example as IBButtonExtender for this the functionality

  • Border Color
  • Border Width
  • Corner Radius

Create an Custom Class for UIButton with @IBDesignable

Create an @IBInspectable for Inspect the element. the Border Color property will be added to the list in the right panel when you create button with this class.

Set Initialization functions and other @IBInspectable as above.

You can check the code for the ButtonExtender.swift


Presenting the ButtonExtender for Border Color, Border Width and Corner Radius function with the @IBDesignable and @IBInspectable in the Swift Language.

By making some corner radius and colors, You will get neat and clean output.



Find IBButtonExtender on github 🙂

Check other articles on Swift Language.

All suggestions are acceptable. Put it in the comments!

Happy Coding 🙂

Facebook Login – Swift Language – iOS 10 – Swift 3

Facebook Login using custom button in Swift Language

Xcode Version 8

Article is Updated with the Facebook 4.16 SDK [27-September-2016].


Install Pods



Create touch up inside event for custom button like as follows

In iOS 10 don’t forget to set capabilities (Keychain Sharing) :

Go to your project targets -> Capabilities -> Keychain Sharing -> Toggle Switch ON

Capabilities - KeyChain Sharing
Capabilities – KeyChain Sharing

Detailed Output Log :

Happy Coding 😀