Git Product home page Git Product logo

adam's Introduction

Adam

(New) Client for gobbl Old one is here https://github.com/gobbl/adam-deprecated

##Gobbl Food Next Door

Dependencies

  1. Facebook SDK
  2. Alamofire
  3. SwiftyJSON
  4. (optional)Mixpanel SDK

Before Run

Pod install. We manage Alamofire and SwiftyJSON by Cocoapods. So before we bagan we mus run

pod install or pod update if you already installed it.

To able to work with current version of server side we have to midify some of the Alamofire library: in order to meet the server's request prameter format.

  1. We add this function.
func queryArrayComponents(key: String, _ value: AnyObject) -> [(String, String)] {
  var components: [(String, String)] = []
  if let array = value as? [AnyObject] {
    var arrayVar:String = ""
    for value in array {
      arrayVar += escape("\(value)")
      arrayVar += ","
    }
    arrayVar.removeAtIndex(arrayVar.endIndex.predecessor())
    components.extend([(escape(key),arrayVar)])
  }
  return components
}
  1. Inside the encode funciton we add the if condition so when we found the batch request(in Array) we shall use queryArrayComponets() instead.
func query(parameters: [String: AnyObject]) -> String {
  var isArray = false
  var components: [(String, String)] = []
  for key in sorted(Array(parameters.keys), <) {
    let value: AnyObject! = parameters[key]

    if let array = value as? [AnyObject] {
      isArray = true
      var QueryComponent = self.queryArrayComponents(key, value)
      components += QueryComponent
    } else {
      var QueryComponent = self.queryComponents(key, value)
      components += QueryComponent
    }
      
  }
  return join("&", components.map{"\($0)=\($1)"})
}

adam's People

Contributors

torishere avatar

Watchers

 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.