ios - Integrate Yelp API into Swift Application -
i trying build iphone application capabilities of searching yelp's database using api. have never used api before (i'm student- not professional development experience), need simple walkthrough on how pull data overall, filter, , authenticate myself data. i'd learn how save location's identifier plist app can store places user visited. appreciated. thank you!
i found online, can't make sense of it. can explain?
class yelpclient: bdboauth1requestoperationmanager { var accesstoken: string! var accesssecret: string! required init(coder adecoder: nscoder) { super.init(coder: adecoder) } init(consumerkey key: string!, consumersecret secret: string!, accesstoken: string!, accesssecret: string!) { self.accesstoken = accesstoken self.accesssecret = accesssecret var baseurl = nsurl(string: "http://api.yelp.com/v2/") super.init(baseurl: baseurl, consumerkey: key, consumersecret: secret); var token = bdboauthtoken(token: accesstoken, secret: accesssecret, expiration: nil) self.requestserializer.saveaccesstoken(token) } func searchwithterm(term: string, parameters: dictionary<string, string>? = nil, offset: int = 0, limit: int = 20, success: (afhttprequestoperation!, anyobject!) -> void, failure: (afhttprequestoperation!, nserror!) -> void) -> afhttprequestoperation! { var params: nsmutabledictionary = [ "term": term, "offset": offset, "limit": limit ] (key, value) in parameters! { params.setvalue(value, forkey: key) } return self.get("search", parameters: params, success: success, failure: failure) } }
Comments
Post a Comment