Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

marcelvoss/MVFollow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MVFollow

MVFollow is a tiny drop-in solution that allows you to follow people on Twitter.

This library requires iOS 10 or later.

Since Apple deprecated Twitter integration in iOS 11, don't expect any future updates to MVFollow.

Installation

CocoaPods

MVFollow is available via CocoaPods. Simply add this to your Podfile: pod 'MVFollow', '~> 0.3.0' and install it with pod install. Boom!

Manually

Download the latest version, add the MVFollow folder to your project and import it.

Usage

Following Accounts

You basically need to use two different methods to follow an account: the accounts(completionHandler:) and the follow(username:, account:, completionHandler:) method.

The accounts(completionHandler:) method returns a closure with an array of ACAccount instances that represent all Twitter accounts on the user's device. You should also check wether the boolean in the closure is set to true and wether the error instance is nil, in order to present your user with an appropriate UI in case of an error.

After accessing the Twitter accounts, you can call the follow(username:, account:, completionHandler:) method and pass it the username you want to follow and the ACAccount instance that is supposed to follow.

Handling Multiple Twitter Accounts

Since the accounts(completionHandler:) method returns an array of ACAccount instances, you should check if the array's count is greater than one.

If that is the case, you should present your user with some kind of UI (for example a UIAlertController with action sheet style) and let them select their preferred Twitter account. MVFollow also provides a quite simple method that takes care of that setup.

The actionSheet(accounts:, username:) method takes an array of ACAccounts, the username you want to follow and returns a UIAlertController with action sheet style and a UIAlertAction for every found Twitter account.

Showing Profiles using Installed Clients

Although, it's a bit inconvient, you'll have to add the following schemes to the LSApplicationQueriesSchemes array in your application's Info.plist, in order to enable MVFollow to query for installed Twitter clients. Otherwise, iOS will always fail trying to open it.

Scheme App
tweetbot Tweetbot
twitter Twitter
twitteriffic Twitteriffic

License

MVFollow is available under the MIT license. See the LICENSE file for more information.

About

MVFollow is a simple drop-in solution that allows you to follow people on Twitter natively.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published