Skip to content

iOS Swift helper library that provides integration with Facebook and Twitter

License

Notifications You must be signed in to change notification settings

folio3/SocialNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SocialNetwork

iOS Swift helper library that provides integration with Facebook and Twitter

Features

Facebook

  • Sign in
  • Friends
  • Invite
  • Taggable friends
  • Albums/Photos
  • Share

Twitter

  • Sign in
  • Friends
  • Invite

Usage

Facebook

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
                }
            }
        }
    }

Login

self.sendRequest(.Login)

Friends

self.sendRequest(.Friends)

Invite

self.sendRequest(.Invite)

Albums

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
            })
        }

Twitter

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
            }
        }
    }

Login

self.sendRequest(.Login)

Friends

self.sendRequest(.Friends)

Invite

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)
}

Credits

SocialNetwork is owned and maintained by Folio3 Pvt Ltd. You can follow them on Twitter at @folio_3 for project updates and releases.

License

SocialNetwork is released under the MIT license. See LICENSE for details.

About

iOS Swift helper library that provides integration with Facebook and Twitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published