iOS Swift helper library that provides integration with Facebook and Twitter
- Sign in
- Friends
- Invite
- Taggable friends
- Albums/Photos
- Share
- Sign in
- Friends
- Invite
private lazy var requestHandler: InviteFacebookRequestHandler = {
return InviteFacebookRequestHandler(viewController: self)
}()
Create a request handler in your class as shown above.
func sendRequest(type: InviteFacebookRequestHandler.RequestType) {
self.requestHandler.sendRequestWithDelay(type.rawValue, parameters: nil) { (result, error) -> Void in
if error == nil {
if self.requestHandler.hasAccessToken() {
if let buddies = result as? [FacebookContact] {
self.contacts = buddies.sort { $0.name.localizedCaseInsensitiveCompare($1.name) == NSComparisonResult.OrderedAscending }
}
// reload table view
}
}
}
}
self.sendRequest(.Login)
self.sendRequest(.Friends)
self.sendRequest(.Invite)
static let facebookHandler = FacebookHandler()
facebookHandler.getUserAlbums(1, pageId: nil, pageType: .Next) { (result, error) -> Void in
self.parser.parse(FBAlbumParser.ParseType.Albums.rawValue, object: result, completion: { (result, error) -> Void in
if let albums = result as? [FacebookAlbum] {
self.albums = albums.sort { $0.name.localizedCaseInsensitiveCompare($1.name) == NSComparisonResult.OrderedAscending }
}
// reload table view
})
}
lazy var requestHandler: InviteTwitterRequestHandler = {
return InviteTwitterRequestHandler(viewController: self)
}()
Create a request handler in your class as shown above.
func sendRequest(type: InviteSocialNetworkRequestHandler.RequestType) {
self.requestHandler.sendRequestWithDelay(type.rawValue, parameters: nil) { (result, error) -> Void in
if error == nil {
if let buddies = result as? [TwitterContact] {
self.contacts = buddies.sort { $0.name.localizedCaseInsensitiveCompare($1.name) == NSComparisonResult.OrderedAscending }
}
// reload table view
}
}
}
self.sendRequest(.Login)
self.sendRequest(.Friends)
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
var actionHandler = InviteTwitterActionHandler(vc: self)
var contact: TwitterContact?
contact = self.contacts[indexPath.row]
actionHandler?.inviteFriends(contact)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
SocialNetwork is owned and maintained by Folio3 Pvt Ltd. You can follow them on Twitter at @folio_3 for project updates and releases.
SocialNetwork is released under the MIT license. See LICENSE for details.