TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | BSD 2.0 |
ReleasedLast Release | Sep 2015 |
SPMSupports SPM | ✗ |
Maintained by Constantine Fry.
Das Quadrat is Foursquare API wrapper written in Swift.
git submodule add [email protected]:Constantine-Fry/das-quadrat.git
Quadrat.xcodeproj
into your project. The project has two targets: Quadrat.framework for OSX project, QuadratTouch.framework for iOS projects.+
button at the top left of the panel and choose “New copy files phase”. You can add source code files directly into your project to support iOS 7.0.
let client = Client(clientID: "FOO.................FOO",
clientSecret: "BAR.................BAR",
redirectURL: "testapp123://foursquare")
var configuration = Configuration(client:client)
Session.setupSharedSessionWithConfiguration(configuration)
let session = Session.sharedSession()
var parameters = [Parameter.query:"Burgers"]
parameters += self.location.parameters()
let searchTask = session.venues.search(parameters) {
(result) -> Void in
if let response = result.response {
self.venues = response["venues"] as [JSONParameters]?
self.tableView.reloadData()
}
}
searchTask.start()
let task1 = self.quadratSession.users.get()
let task2 = self.quadratSession.users.friends(userId: "self", parameters: nil)
let multiTask = self.quadratSession.multi.get([task1, task2]){
(responses) -> Void in
println(responses)
}
multiTask.start()
The library will attempt to authorize natively via the actual Foursquare app, if installed. It will switch to the app to authorize, and then switch back to your app on success. Currently, there is no mechanism in place in Foursquare’s app to switch back to your app if the user cancels the authorization from there, so the user will need to return to your app manually if they choose to cancel the authorization.
If the Foursquare app is not installed on the user’s device, your app will instead present a modal view controller containing a UIWebView
that will display a web-based authorization screen instead. This occurs without leaving your app, and can be cancelled to return to the previous screen.
On iOS9 an app must declare which URL scheme it wants to check with canOpenURL:
. To enable native authorization with Foursquare app you must add foursquareauth
to LSApplicationQueriesSchemes
array in info.plist file in your project.
Swift 2.0 / iOS 8.0+ / Mac OS X 10.9+
The BSD 2-Clause License. See License.txt for details.
Bonn, December 2014.