Skip to content

Commit

Permalink
Bundle and sub sub array fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vermeer, Edwin authored and Vermeer, Edwin committed May 11, 2017
1 parent 8e66c11 commit 1a552d0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion EVReflection.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "EVReflection"
s.version = "4.10.2"
s.version = "4.11.0"
s.summary = "Reflection based (dictionary, JSON or XML) object mapping (including extensions for Alamofire and Moya with RxSwift or ReactiveSwift)"

s.description = <<-EOS
Expand Down
Binary file not shown.
16 changes: 8 additions & 8 deletions PerformanceTest/PerformanceTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
7F6C9FB91CB90E6D00F19811 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7F6C9FBC1CB90E6D00F19811 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
7F6C9FBE1CB90E6D00F19811 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7FF9B86D1E23A1B50089A3A1 /* PerformanceTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PerformanceTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
7FF9B86D1E23A1B50089A3A1 /* Performance.Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Performance.Test.app; sourceTree = BUILT_PRODUCTS_DIR; };
7FF9B8751E23B7230089A3A1 /* Pods_Demo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_Demo.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/EVReflection-eilzlmnqxgcrihduagopeottnnos/Build/Products/Debug-iphonesimulator/Pods_Demo.framework"; sourceTree = "<group>"; };
7FF9B8771E23BCF00089A3A1 /* Pods_PerformanceTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_PerformanceTest.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/EVReflection-eilzlmnqxgcrihduagopeottnnos/Build/Products/Debug-iphonesimulator/Pods_PerformanceTest.framework"; sourceTree = "<group>"; };
B1F64CFF84CC6A246842DD2C /* Pods-PerformanceTest.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PerformanceTest.release.xcconfig"; path = "../Pods/Target Support Files/Pods-PerformanceTest/Pods-PerformanceTest.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -85,7 +85,7 @@
7F6C9FB11CB90E6D00F19811 /* EVReflectionTest */,
2AC2754D5005AFF91FD3A16D /* Pods */,
6B581D00DE30D4A9D56026F2 /* Frameworks */,
7FF9B86D1E23A1B50089A3A1 /* PerformanceTest.app */,
7FF9B86D1E23A1B50089A3A1 /* Performance.Test.app */,
);
sourceTree = "<group>";
};
Expand All @@ -107,9 +107,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
7F6C9FAF1CB90E6D00F19811 /* PerformanceTest */ = {
7F6C9FAF1CB90E6D00F19811 /* Performance.Test */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7F6C9FBF1CB90E6D00F19811 /* Build configuration list for PBXNativeTarget "PerformanceTest" */;
buildConfigurationList = 7F6C9FBF1CB90E6D00F19811 /* Build configuration list for PBXNativeTarget "Performance.Test" */;
buildPhases = (
F00C3A074FB799B6C3C80311 /* [CP] Check Pods Manifest.lock */,
7F6C9FAC1CB90E6D00F19811 /* Sources */,
Expand All @@ -123,9 +123,9 @@
);
dependencies = (
);
name = PerformanceTest;
name = Performance.Test;
productName = EVReflectionTestApp;
productReference = 7FF9B86D1E23A1B50089A3A1 /* PerformanceTest.app */;
productReference = 7FF9B86D1E23A1B50089A3A1 /* Performance.Test.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -157,7 +157,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
7F6C9FAF1CB90E6D00F19811 /* PerformanceTest */,
7F6C9FAF1CB90E6D00F19811 /* Performance.Test */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -397,7 +397,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7F6C9FBF1CB90E6D00F19811 /* Build configuration list for PBXNativeTarget "PerformanceTest" */ = {
7F6C9FBF1CB90E6D00F19811 /* Build configuration list for PBXNativeTarget "Performance.Test" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7F6C9FC01CB90E6D00F19811 /* Debug */,
Expand Down
6 changes: 3 additions & 3 deletions Source/EVReflection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,13 @@ final public class EVReflection {

fileprivate static func nameForBundle(_ bundle: Bundle) -> String {
// get the bundle name from what is set in the infoDictionary
var appName = bundle.infoDictionary?[kCFBundleNameKey as String] as? String ?? ""
var appName = bundle.infoDictionary?[kCFBundleExecutableKey as String] as? String ?? ""

// If it was not set, then use the bundleIdentifier (which is the same as kCFBundleIdentifierKey)
if appName == "" {
appName = bundle.bundleIdentifier ?? ""
appName = appName.characters.split(whereSeparator: {$0 == "."}).map({ String($0) }).last ?? ""
}
appName = appName.characters.split(whereSeparator: {$0 == "."}).map({ String($0) }).last ?? ""

// Clean up special characters
return appName.components(separatedBy: illegalCharacterSet).joined(separator: "_")
Expand Down Expand Up @@ -1283,7 +1283,7 @@ final public class EVReflection {
result.removeAll()

for item in array {
let org = getTypeFor(anyObject: anyObject, key: key, type: type, item: item)
let org = getTypeFor(anyObject: anyObject, key: key, type: subtype, item: item)
let (arrayObject, valid) = dictToObject(subtype, original:org, dict: item as? NSDictionary ?? NSDictionary(), conversionOptions: conversionOptions)
if arrayObject != nil && valid {
result.append(arrayObject!)
Expand Down
2 changes: 2 additions & 0 deletions UnitTests/EVReflectionTests/EVReflectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,14 @@ class EVReflectionTests: XCTestCase {
let json = "{\"array\":[[{\"openId\":\"value1\"},{\"openId\":\"value2\"}],[{\"openId\":\"value3\"},{\"openId\":\"value4\"}]]}"
let obj = A81b(json: json)
print(obj)
XCTAssert(obj.array[0].count == 2, "2 dimentional array should have 2 items inside the first item")
}

func testNestedNestedArray(){
let json = "{\"array\":[[[{\"openId\":\"value1\"},{\"openId\":\"value2\"}],[{\"openId\":\"value3\"},{\"openId\":\"value4\"}]]]}"
let obj = A81c(json: json)
print(obj)
XCTAssert(obj.array[0][0].count == 2, "3 dimentional array should have 2 items inside the first item of the first item")
}
}

Expand Down

0 comments on commit 1a552d0

Please sign in to comment.