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.
BusinessesViewController.swift
to see how to use the Business
model.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!)
}
}
Here's a walkthrough of implemented user stories:
GIF created with LiceCap.
I tried to complite the search bar but there were some problems when I tried to find the scarching word from NSDictionary and return the match cell. I'll discuss with mentor during class.
Copyright [2016] [Xiaoxi Zhang]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.