Reputation: 3083
I don't know Objective-C. They have no code samples on their page for Swift. Has anyone used their new V2 API with Swift yet who can provide some examples or simple searches such as querying local restaurants nearby and more importantly how to provide their required keys?
Upvotes: 3
Views: 2158
Reputation: 9
Try this: https://github.com/codepath/ios_yelp_swift
Basic Yelp client
This is a headless example of how to implement an OAuth 1.0a Yelp API client. The Yelp API provides an application token that allows applications to make unauthenticated requests to their search API.
Next steps
Check out BusinessesViewController.swift to see how to use the Business model. Sample request
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 with categories, sort, and deal filters
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!) } }
Upvotes: 0