From: masakih Date: Sun, 12 Mar 2017 15:27:20 +0000 (+0900) Subject: APIResponseのENABLE_JSON_LOG部分を移動 X-Git-Tag: 1.9b3~26 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c5d76d6e6690bb634dfffea3eef5074bcbf32d8a;p=kcd%2FKCD.git APIResponseのENABLE_JSON_LOG部分を移動 JSONViewCommandにENABLE_JSON_LOGを集約 --- diff --git a/KCD/APIResponse.swift b/KCD/APIResponse.swift index e27e968b..9bfcdf67 100644 --- a/KCD/APIResponse.swift +++ b/KCD/APIResponse.swift @@ -59,10 +59,6 @@ struct APIResponse { return false } - #if ENABLE_JSON_LOG - let argumentArray: [[String: String]] - #endif - init?(request: URLRequest, data: Data) { date = Date() @@ -86,11 +82,5 @@ struct APIResponse { return nil } self.api = api - - #if ENABLE_JSON_LOG - argumentArray = parameter.map { (key, value) in - ["key": key, "value": value] - } - #endif } } diff --git a/KCD/JSONViewCommand.swift b/KCD/JSONViewCommand.swift index 6e2cd35f..173418db 100644 --- a/KCD/JSONViewCommand.swift +++ b/KCD/JSONViewCommand.swift @@ -18,7 +18,9 @@ class JSONViewCommand: JSONCommand { init(apiResponse: APIResponse, command: JSONCommand) { self.recieveDate = Date() - self.parameterList = apiResponse.argumentArray + self.parameterList = apiResponse + .parameter + .map { ["key": $0.0, "value": $0.1] } self.jsonTree = JSONNode .nodeWithJSON(apiResponse.json as AnyObject?) .map { [$0] }