Home

Awesome

FSNetworkingSearchController

Join the chat at https://gitter.im/alexruperez/FSNetworkingSearchController Twitter GitHub Issues CI Status Version License Platform Dependency Status Analytics

Overview

Search controller with suggest completion using Foursquare API following Instagram design.

FSNetworkingSearchController Screenshot

Installation

FSNetworkingSearchController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FSNetworkingSearchController"

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

FSNetworkingSearchController

Call + (void)configureWithClientID:(NSString *)clientID clientSecret:(NSString *)clientSecret redirectURI:(NSString *)redirectURI

[FSNetworkingSearchController configureWithClientID:@"YOUR_CLIENT_ID" clientSecret:@"YOUR_CLIENT_SECRET" redirectURI:@"YOUR_REDIRECT_URI"];

If you need to login for accurated results call + (void)loginWithCompletion:(FSNSCAccessTokenBlock)completion and put + (BOOL)handleOpenURL:(NSURL *)handledURL in your - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [FSNetworkingSearchController handleOpenURL:url];
}

[FSNetworkingSearchController loginWithCompletion:^(NSString *accessToken, NSError *error) {
    NSLog(@"DO STUFF");
}];

FSNetworkingSearchController automatically gets the user location if you don't already do it, only put NSLocationWhenInUseUsageDescription key in your plist. But you could force to use a custom CLLocation with the method + (void)forceLocation:(CLLocation *)location, for example if you what to use the metadata of an image.

FSNetworkingViewHandler

Use it as your UISearchDisplayController delegate, UISearchController searchResultsUpdater or your UITableView dataSource and delegate. Your could do it programmatically or using the storyboard like in the example project. Have IBInspectable properties.

You could customize it or set the selectHandler to detect selected Foursquare Venue.

FSNetworkingCommunicator

I use foursquare/FSNetworking to make the API requests, but it's a protocol, you can inject your own to the FSNetworkingSearchController or mock it if you need.

Etc.

Use it? Love/hate it?

Tweet the author @alexruperez, and check out alexruperez's blog: http://alexruperez.com

License

FSNetworkingSearchController is available under the MIT license. See the LICENSE file for more info.