{"id":19805609,"url":"https://github.com/remirobert/foursquare-kit-ios","last_synced_at":"2025-05-01T06:31:17.714Z","repository":{"id":56911633,"uuid":"117310929","full_name":"remirobert/foursquare-kit-ios","owner":"remirobert","description":"Foursquare Kit is a native SDK to include Foursquare API inside mobile apps.","archived":false,"fork":false,"pushed_at":"2019-04-22T02:41:39.000Z","size":65,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-24T01:46:10.346Z","etag":null,"topics":["foursquare-api","swift4"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remirobert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-13T03:32:34.000Z","updated_at":"2024-11-07T05:29:05.000Z","dependencies_parsed_at":"2022-08-21T03:20:09.052Z","dependency_job_id":null,"html_url":"https://github.com/remirobert/foursquare-kit-ios","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2Ffoursquare-kit-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2Ffoursquare-kit-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2Ffoursquare-kit-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remirobert%2Ffoursquare-kit-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remirobert","download_url":"https://codeload.github.com/remirobert/foursquare-kit-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251835591,"owners_count":21651678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foursquare-api","swift4"],"created_at":"2024-11-12T09:04:40.224Z","updated_at":"2025-05-01T06:31:17.403Z","avatar_url":"https://github.com/remirobert.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://pbs.twimg.com/media/CEKwK7HUIAAxuF1.png)\n\n# foursquare-kit-ios\n\n[![Build Status](https://app.bitrise.io/app/0cf816feba3589af/status.svg?token=ayNjto69DKgym6_Hy8vDDg)](https://app.bitrise.io/app/0cf816feba3589af)\n[![codecov](https://codecov.io/gh/remirobert/foursquare-kit-ios/branch/master/graph/badge.svg)](https://codecov.io/gh/remirobert/foursquare-kit-ios)\n\nFoursquare Kit is a easy way to use the Foursquare API in your apps. You can search for venues, get details and photos.\nIt's a very light framework without any dependencies, extensible, and tested. It doesn't cover all the APIs yet. If you have a specific need, please be free to open an issue, or a pull request.\n\n## Installation\n\nTo add Foursquare Kit to your app, simply add **FoursquareKit** to your ```Podfile```.\n\n```\ntarget 'MyApp' do\n  use_frameworks!\n  pod 'FoursquareKit'\nend\n```\n\n## Initialize a FoursquareClient instance\n\nYou can authentificate to the Foursquare API with **client_id / client_secret** or with a **token**.\n\n```Swift\nimport FoursquareKit\n\nclass RestaurantsViewController: UIViewController {\n  override viewDidLoad() {\n    super.viewDidLoad()\n    let auth = Authentification(clientId: \"123\", clientSecret: \"456\")\n    let client = FoursquareClient(authentification: auth)\n  }\n}\n```\n\n## Performing API requests\n\nStart by creating a reference to the **FoursquareClient** instance that you will use to make your API calls.\n\nSearching for venues (documentation https://developer.foursquare.com/docs/api/venues/search):\n```Swift\nlet parameters = [\"ll\" : \"44.3,37.2\"]\nclient.search.venues(parameters: parameters).response { result in\n  switch result {\n    case .success(let data):\n      venues = data.response.venues\n    case .failure(let error):\n      print(\"error : \\(error)\")\n  }\n}\n```\n\nSearching for trending venues (documentation https://developer.foursquare.com/docs/api/venues/trending):\n```Swift\nlet parameters = [\"ll\" : \"44.3,37.2\"]\nclient.search.trending(parameters: parameters).response { result in\n  switch result {\n    case .success(let data):\n      venues = data.response.venues\n    case .failure(let error):\n      print(\"error : \\(error)\")\n  }\n}\n```\n\nGet details for a venue (documentation https://developer.foursquare.com/docs/api/venues/details):\n```Swift\nclient.venue.details(id: \"123\").response { result in\n  switch result {\n    case .success(let data):\n      venue = data.response.venue\n    case .failure(let error):\n      print(\"error : \\(error)\")\n  }\n}\n```\n\nGet photos for a venue (documentation https://developer.foursquare.com/docs/api/venues/photos):\n```Swift\nclient.venue.photos(id: \"123\").response { result in\n  switch result {\n    case .success(let data):\n      photos = data.response.photos.items\n    case .failure(let error):\n      print(\"error : \\(error)\")\n  }\n}\n```\n\n## Cache 📦\n\nYou can add a cache strategy for each Request, to allow to get the data from local storage.\nFoursquare Kit was designed with no external dependency. Foursquare Kit can works with any cache libraries.\n\nFor doing that, your cache implementation has to conform to the protocol **Cachable**.\nThen calling the cache function and pass the **Cachable object**.\n\nHere an example for PINCache:\n```Swift\nextension PINCache: FoursquareKit.Cachable {\n  func data(forKey key: String, completion: ((Data?) -\u003e Swift.Void)) {\n    self.object(forKey: key) { (_, _, object) in\n      completion(object as? Data)\n    }\n  }\n  \n  func set(data: Data, forKey key: String) {\n    self.setObject(data, forKey: key)\n  }\n}\n\nlet request = client.venue.photos(id: \"123\")\nrequest\n  .cache(PINCache.shared)\n  .response { result in\n  //...\n}\n\n```\n\n\n## Cancelling a request ✋\n\nAll the API calls will return a ```Request\u003cT: Codable\u003e``` object, simply call the ```cancel``` function to cancel the network call.\n```Swift\nlet request = client.venue.photos(id: \"123\").response { result in\n  //...\n}\nrequest.cancel()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Ffoursquare-kit-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremirobert%2Ffoursquare-kit-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremirobert%2Ffoursquare-kit-ios/lists"}