How do I use the Yelp API in Swift?
1 answer
Try this: https://github.com/codepath/ios_yelp_swift
Yelp main client
This is a headless example of how to implement the OAuth 1.0a Yelp client API. The Yelp API provides an application token that allows applications to make unauthorized requests to their search API.
Next steps
Check out BusinessesViewController.swift to learn how to use the Business Model. Request example
Basic search with query
Business.searchWithTerm("Thai", completion: { (businesses: [Business]!, error: NSError!) -> Void in self.businesses = businesses for business in businesses { print(business.name!) print(business.address!) } })
Advanced search using categories, sorting and filtering deals
Business.searchWithTerm("Restaurants", sort: .Distance, categories: ["asianfusion", "burgers"], deals: true) { (businesses: [Business]!, error: NSError!) -> Void in for business in businesses { print(business.name!) print(business.address!) } }
0
source to share