From 3641299a4a408cb5cc709c22d9e8b239f5a4bc0e Mon Sep 17 00:00:00 2001 From: PhilCai Date: Thu, 18 Feb 2016 23:07:43 +0800 Subject: [PATCH] update function name to make it clear --- ObjectMapper/Core/Map.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ObjectMapper/Core/Map.swift b/ObjectMapper/Core/Map.swift index 78c642cd..14e9e3e1 100644 --- a/ObjectMapper/Core/Map.swift +++ b/ObjectMapper/Core/Map.swift @@ -121,7 +121,7 @@ private func valueFor(keyPathComponents: ArraySlice, dictionary: [String return valueFor(tail, dictionary: dict) } else if let array = object as? [AnyObject] where keyPathComponents.count > 1 { let tail = keyPathComponents.dropFirst() - return valueFor(tail, dictionary: array) + return valueFor(tail, array: array) } else { return object } @@ -131,7 +131,7 @@ private func valueFor(keyPathComponents: ArraySlice, dictionary: [String } /// Fetch value from JSON Array, loop through keyPathComponents them until we reach the desired object -private func valueFor(keyPathComponents: ArraySlice, dictionary: [AnyObject]) -> AnyObject? { +private func valueFor(keyPathComponents: ArraySlice, array: [AnyObject]) -> AnyObject? { // Implement it as a tail recursive function. if keyPathComponents.isEmpty { @@ -140,15 +140,15 @@ private func valueFor(keyPathComponents: ArraySlice, dictionary: [AnyObj //Try to convert keypath to Int as index if let keyPath = keyPathComponents.first, - let index = Int(keyPath) where index >= 0 && index < dictionary.count { + let index = Int(keyPath) where index >= 0 && index < array.count { - let object = dictionary[index] + let object = array[index] if object is NSNull { return nil } else if let array = object as? [AnyObject] where keyPathComponents.count > 1 { let tail = keyPathComponents.dropFirst() - return valueFor(tail, dictionary: array) + return valueFor(tail, array: array) } else if let dict = object as? [String : AnyObject] where keyPathComponents.count > 1 { let tail = keyPathComponents.dropFirst() return valueFor(tail, dictionary: dict)