How To Implement A Social Networking Feed Using iOS App Development

Social networking is mainly used to share the latest news, update, share a comment, liking others post/feed, user can download/ upload audio/video/images. Social networking is useful also but sometime it will be very risky where intruders always try to steal data from the account also. Social networking capability enabled by developers and they control which feed users can do in social networking as well as a developer can control the privacy where limited data can be feed in the post also. Initially, there was no library in the iOS App development services company that can do direct feed/post the data into the social networking site, and companies are not tie up to provide a facility to access social networking but now new libraries introduced in the apple which is called Social framework.

Initially, there was no library in iOS that can do direct feed/post the data into the social networking side and companies are not tie up to provide the facility to access social networking but now a new library introduced in the apple which is called as Social framework.

Library Used: 

  • Social
  • UIKit
  • Foundation
  • iMessage

Social Networking Type : 

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
  • iMessage

Main component for Social Library

SLComposeServiceViewController is the main component for the social library which can be used to feed or to pop out the default social app and then the user can select the desired or default app from the popup to login and feed into the social website.

SLComposeSheetConfigurationItem is used in the social framework to do configuration level change for Social sites. This will allow users to share the album, current location, and share the multiple items at a time in social sites.

ReloadConfigurationItems is used for configuration is changed as user-level or not. If it got changed then user can feed or post content on the social side.

Implementation of Social Networking

1. Import the Social Networking library in the file

  1. Creation of Twitter button to call out twitter using SLComposeViewController where popup will appear if the user wants to post something in social sites.

@IBActionfunctwitterSharingButton(_ sender: Any) {

if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeTwitter) {

let sharingtweet= SLComposeViewController(forServiceType: SLServiceTypeTwitter)

if let sharingtweet= sharingtweet{

sharingtweet.setInitialText(“Share Rwi”)

sharingtweet.add(UIImage(named: “tee.jpg”)!)

sharingtweet.add(URL(string: “https://social.com”))

self.present(tweetShare, animated: true, completion: nil)

}

} else {

print(“Not Available”)

}

}

  1. Creation of Facebook button to call out Facebook using SLComposeViewController where popup will appear if the user want to post something on social sites.

@IBActionfuncfacebookSharingButton(_ sender: Any) {

if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeFacebook) {

let facebookShare = SLComposeViewController(forServiceType: SLServiceTypeFacebook)

if let facebookShare= facebookShare{

facebookShare.setInitialText(“sharing facebook”)

facebookShare.add(UIImage(named: “facebook.jpg”)!)

facebookShare.add(URL(string: “https://facebookfeed.com”))

self.present(facebookShare, animated: true, completion: nil)

}

} else {

print(“Not Available”)

}

}

  1. User can share text/ images/audio and video by using Social Frmaework by choosing anyone from the above and it depend on the user’s requirment

@IBActionfuncsharingSocialAll(_ sender: UIButton) {

let text = “Sharing ”

let socialimage = UIImage(named: “FB”)

let myWebsite = NSURL(string:”https://socialall.com”)

let sharingAll= [text , image! , socialimage]

let activityViewController = UIActivityViewController(activityItems: shareAll, applicationActivities: nil)

activityViewController.popoverPresentationController?.sourceView = self.view

self.present(activityViewController, animated: true, completion: nil)

}

@IBActionfuncsharingSocialText(_ sender: UIButton) {

let text = “Sharing ”

let sharingtext= [text , image! , socialimage]

let activityViewController = UIActivityViewController(activityItems: sharingtext, applicationActivities: nil)

activityViewController.popoverPresentationController?.sourceView = self.view

self.present(activityViewController, animated: true, completion: nil)

}

@IBActionfuncsharingSocialImage(_ sender: UIButton) {

let sharingImag= [image!]

let activityViewController = UIActivityViewController(activityItems: sharingImag, applicationActivities: nil)

activityViewController.popoverPresentationController?.sourceView = self.view

self.present(activityViewController, animated: true, completion: nil)

}