0001    // The MIT License (MIT)
0002    
0003    // Copyright (c) 2015 JohnLui <wenhanlv@gmail.com> https://github.com/johnlui
0004    
0005    // Permission is hereby granted, free of charge, to any person obtaining a copy
0006    // of this software and associated documentation files (the "Software"), to deal
0007    // in the Software without restriction, including without limitation the rights
0008    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0009    // copies of the Software, and to permit persons to whom the Software is
0010    // furnished to do so, subject to the following conditions:
0011    
0012    // The above copyright notice and this permission notice shall be included in all
0013    // copies or substantial portions of the Software.
0014    
0015    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016    // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0018    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0019    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0020    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0021    // SOFTWARE.
0022    //
0023    //  Helper.swift
0024    //  Pitaya
0025    //
0026    //  Created by 吕文翰 on 15/10/7.
0027    //
0028    
0029    import Foundation
0030    
0031    class Helper
Helper.swift:37
            components += Helper.queryComponents(key, value)
Helper.swift:45
        components.appendContentsOf([(Helper.escape(key), Helper.escape("\(value)"))])        
Helper.swift:45
        components.appendContentsOf([(Helper.escape(key), Helper.escape("\(value)"))])        
PitayaManager.swift:118
            self.request = NSMutableURLRequest(URL: NSURL(string: url + "?" + Helper.buildParams(self.params!))!)
PitayaManager.swift:171
            data.appendData(Helper.buildParams(self.params!).nsdata)
{ 0032 // stolen from Alamofire 0033 static func buildParams
PitayaManager.swift:118
            self.request = NSMutableURLRequest(URL: NSURL(string: url + "?" + Helper.buildParams(self.params!))!)
PitayaManager.swift:171
            data.appendData(Helper.buildParams(self.params!).nsdata)
(parameters: [String: AnyObject]) -> String { 0034 var components: [(String, String)] = [] 0035 for key in Array(parameters.keys).sort(<) { 0036 let value: AnyObject! = parameters[key] 0037 components += Helper.queryComponents(key, value) 0038 } 0039 0040 return components.map{"\($0)=\($1)"}.joinWithSeparator("&") 0041 } 0042 // stolen from Alamofire 0043 static func queryComponents
Helper.swift:37
            components += Helper.queryComponents(key, value)
(key: String, _ value: AnyObject) -> [(String, String)] { 0044 var components: [(String, String)] = [] 0045 components.appendContentsOf([(Helper.escape(key), Helper.escape("\(value)"))]) 0046 return components 0047 } 0048 // stolen from Alamofire 0049 static func escape
Helper.swift:45
        components.appendContentsOf([(Helper.escape(key), Helper.escape("\(value)"))])        
Helper.swift:45
        components.appendContentsOf([(Helper.escape(key), Helper.escape("\(value)"))])        
(string: String) -> String { 0050 let legalURLCharactersToBeEscaped: CFStringRef = ":&=;+!@#$()',*" 0051 return CFURLCreateStringByAddingPercentEscapes(nil, string, nil, legalURLCharactersToBeEscaped, CFStringBuiltInEncodings.UTF8.rawValue) as String 0052 } 0053 }