Giter Site home page Giter Site logo

shinisaru / das-quadrat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from constantine-fry/das-quadrat

0.0 2.0 0.0 328 KB

A Swift wrapper for Foursquare API. iOS and OSX.

License: BSD 2-Clause "Simplified" License

Swift 98.82% Ruby 0.49% Objective-C 0.69%

das-quadrat's Introduction

Das Quadrat Carthage compatible

Das Quadrat is Foursquare API wrapper written in Swift.

###Features

  • Supports iOS and OSX.
  • Covers all API endpoints.
  • Authorization process implemented for both platforms.
  • Native authorization on iOS.
  • Image downloader/uploader.
  • Image cache.
  • Supports multiple accounts.

###Installation

Carthage Installation

Install Das Quadrat using the Carthage dependency manager.

github "Constantine-Fry/das-quadrat" >= 1.0

Cocoapods

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'QuadratTouch', '>= 1.0'

Embedded framework (iOS 8.0+)

  1. Add Das Quadrat as a submodule. git submodule add [email protected]:Constantine-Fry/das-quadrat.git
  2. Drag-and-drop Quadrat.xcodeproj into your project. The project has two targets: Quadrat.framework for OSX project, QuadratTouch.framework for iOS projects.
  3. Add new target in "Build Phases" -> "Target Dependencies".
  4. Click the + button at the top left of the panel and choose "New copy files phase".
  • Rename the new phase to "Copy Frameworks".
  • Set the "Destination" to "Frameworks".
  1. Add Quadrat framework to this phase.
  2. Here is the image to visualise the result.
  3. Read wiki for details.

You can add source code files directly into your project to support iOS 7.0.

###Usage

#####Setup session

let client = Client(clientID:       "FOO.................FOO",
   					clientSecret:   "BAR.................BAR",
    				redirectURL:    "testapp123://foursquare")
var configuration = Configuration(client:client)
Session.setupSharedSessionWithConfiguration(configuration)

let session = Session.sharedSession()

#####Search request

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()

#####Multi request

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()

#####Native authorization

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.

###Requirements

Swift 2.0 / iOS 8.0+ / Mac OS X 10.9+

###License

The BSD 2-Clause License. See License.txt for details.

=========== Bonn, December 2014.

das-quadrat's People

Contributors

julianshen avatar adlai-holler avatar benguild avatar notbenoit avatar gfhuertac avatar

Watchers

James Cloos avatar Vlad Sikorsky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.